Interface JSONArtifact

All Known Implementing Classes:
JSONArray, JSONObject, OrderedJSONObject

public interface JSONArtifact
Interface class to define a set of generic apis both JSONObject and JSON array implement. This is namely so that functions such as serialize, which are common between the two, can be easily invoked.
  • Method Summary

    Modifier and Type
    Method
    Description
    Convert this object into a String of JSON text.
    serialize(boolean verbose)
    Convert this object into a String of JSON text, specifying verbosity.
    void
    Convert this object into a stream of JSON text.
    void
    serialize(OutputStream os, boolean verbose)
    Convert this object into a stream of JSON text.
    void
    serialize(Writer writer)
    Convert this object into a stream of JSON text.
    void
    serialize(Writer writer, boolean verbose)
    Convert this object into a stream of JSON text, specifying verbosity.
  • Method Details

    • serialize

      void serialize(OutputStream os) throws IOException
      Convert this object into a stream of JSON text. Same as calling serialize(os,false); Note that encoding is always written as UTF-8, as per JSON spec.
      Parameters:
      os - The output stream to serialize data to.
      Throws:
      IOException - Thrown on IO errors during serialization.
    • serialize

      void serialize(OutputStream os, boolean verbose) throws IOException
      Convert this object into a stream of JSON text. Same as calling serialize(writer,false); Note that encoding is always written as UTF-8, as per JSON spec.
      Parameters:
      os - The output stream to serialize data to.
      verbose - Whether or not to write the JSON text in a verbose format.
      Throws:
      IOException - Thrown on IO errors during serialization.
    • serialize

      void serialize(Writer writer) throws IOException
      Convert this object into a stream of JSON text. Same as calling serialize(writer,false);
      Parameters:
      writer - The writer which to serialize the JSON text to.
      Throws:
      IOException - Thrown on IO errors during serialization.
    • serialize

      void serialize(Writer writer, boolean verbose) throws IOException
      Convert this object into a stream of JSON text, specifying verbosity.
      Parameters:
      writer - The writer which to serialize the JSON text to.
      Throws:
      IOException - Thrown on IO errors during serialization.
    • serialize

      String serialize(boolean verbose) throws IOException
      Convert this object into a String of JSON text, specifying verbosity.
      Parameters:
      verbose - Whether or not to serialize in compressed for formatted Strings.
      Throws:
      IOException - Thrown on IO errors during serialization.
    • serialize

      String serialize() throws IOException
      Convert this object into a String of JSON text. Same as serialize(false);
      Throws:
      IOException - Thrown on IO errors during serialization.