Interface JSONObjects
-
public interface JSONObjectsAPI for creating in memory JSON Object representations, and for serializing in memory Object Graphs to JSON representations.- Author:
- cdivilly
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description JSONArray.Builderarray()Create a newJSONArray.BuilderinstanceJSONObject.Builderobject()Create a newJSONObject.BuilderinstanceJSONNoderead(java.io.InputStream stream)Parse a byte stream into aJSONObjectorJSONArrayinstanceJSONNoderead(java.io.Reader stream)Parse a character stream into aJSONObjectorJSONArrayinstanceJSONNoderead(java.lang.CharSequence text)Parse a character stream into aJSONObjectorJSONArrayinstanceJSONNoderead(java.util.Iterator<JSONToken> stream)Parse a JSONToken stream into aJSONObjectorJSONArrayinstancevoidwrite(java.io.OutputStream stream, java.lang.Object objectGraph)Serialize any Java Object graph to it's textual representation.voidwrite(java.io.OutputStream stream, JSONNode node)Serialize a JSON Object graph to it's textual representationvoidwrite(java.lang.Appendable stream, java.lang.Object objectGraph)Serialize any Java Object graph to it's textual representation.voidwrite(java.lang.Appendable stream, JSONNode node)Serialize a JSON Object graph to it's textual representationvoidwrite(JSONWriter stream, java.lang.Object objectGraph)Serialize any Java Object graph to aJSONWriterstream.voidwrite(JSONWriter stream, JSONNode node)Serialize a JSON Object graph to aJSONWriterstream
-
-
-
Method Detail
-
array
JSONArray.Builder array()
Create a newJSONArray.Builderinstance- Returns:
JSONArray.Builderinstance
-
object
JSONObject.Builder object()
Create a newJSONObject.Builderinstance- Returns:
JSONObject.Builderinstance
-
read
JSONNode read(java.lang.CharSequence text)
Parse a character stream into aJSONObjectorJSONArrayinstance- Parameters:
text- The JSON textual representation to be parsed- Returns:
JSONObjectorJSONArrayinstance
-
read
JSONNode read(java.io.InputStream stream) throws JSONIOException
Parse a byte stream into aJSONObjectorJSONArrayinstance- Parameters:
stream- The JSON textual representation to be parsed- Returns:
JSONObjectorJSONArrayinstance- Throws:
JSONIOException- if anIOExceptionoccurs reading from the stream
-
read
JSONNode read(java.util.Iterator<JSONToken> stream) throws JSONIOException
Parse a JSONToken stream into aJSONObjectorJSONArrayinstance- Parameters:
stream- TheJSONTokenstream to be parsed- Returns:
JSONObjectorJSONArrayinstance- Throws:
JSONIOException- if anIOExceptionoccurs reading from the stream
-
read
JSONNode read(java.io.Reader stream) throws JSONIOException
Parse a character stream into aJSONObjectorJSONArrayinstance- Parameters:
stream- The JSON textual representation to be parsed- Returns:
JSONObjectorJSONArrayinstance if anIOExceptionoccurs reading from the stream- Throws:
JSONIOException
-
write
void write(java.lang.Appendable stream, JSONNode node) throws JSONIOExceptionSerialize a JSON Object graph to it's textual representation- Parameters:
stream- The character stream to serialize tonode- TheJSONObjectorJSONNodeat the root of the object graph- Throws:
JSONIOException- if an IO error occurs
-
write
void write(java.lang.Appendable stream, java.lang.Object objectGraph) throws JSONIOExceptionSerialize any Java Object graph to it's textual representation.
- Parameters:
stream- The character stream to serialize toobjectGraph- The root node in the object graph- Throws:
JSONIOException- if an IO error occurs- See Also:
- Serializing Java Object Graphs
-
write
void write(JSONWriter stream, JSONNode node) throws JSONIOException
Serialize a JSON Object graph to aJSONWriterstream- Parameters:
stream- TheJSONWriterstream to serialize tonode- TheJSONObjectorJSONNodeat the root of the object graph- Throws:
JSONIOException- if an IO error occurs
-
write
void write(JSONWriter stream, java.lang.Object objectGraph) throws JSONIOException
Serialize any Java Object graph to a
JSONWriterstream.- Parameters:
stream- TheJSONWriterstream to serialize toobjectGraph- The root node in the object graph- Throws:
JSONIOException- if an IO error occurs- See Also:
- Serializing Java Object Graphs
-
write
void write(java.io.OutputStream stream, JSONNode node) throws JSONIOExceptionSerialize a JSON Object graph to it's textual representation- Parameters:
stream- The byte stream to serialize tonode- TheJSONObjectorJSONNodeat the root of the object graph- Throws:
JSONIOException- if an IO error occurs
-
write
void write(java.io.OutputStream stream, java.lang.Object objectGraph) throws JSONIOExceptionSerialize any Java Object graph to it's textual representation.
- Parameters:
stream- The byte stream to serialize toobjectGraph- The root node in the object graph- Throws:
JSONIOException- if an IO error occurs- See Also:
- Serializing Java Object Graphs
-
-