Package com.blackrook.json
Class JSONWriter
java.lang.Object
com.blackrook.json.JSONWriter
A class for writing JSON data to JSON representation.
- Author:
- Matthew Tropiano
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
The JSON export options to pass to the writer methods. -
Constructor Summary
ConstructorDescriptionJSONWriter
(JSONWriter.Options options) Creates a new JSONWriter with a set of options to be used for every write. -
Method Summary
Modifier and TypeMethodDescriptionvoid
write
(JSONObject jsonObject, OutputStream out) Writes a JSONObject out to the following output stream.void
write
(JSONObject jsonObject, Writer writer) Writes a JSONObject out to the following output stream.void
write
(Object object, OutputStream out) Writes a JSONObject out to the following output stream.void
Writes a JSONObject out to the following output stream.static void
writeJSON
(JSONObject jsonObject, JSONWriter.Options options, OutputStream out) Writes a JSONObject out to the following output stream.static void
writeJSON
(JSONObject jsonObject, JSONWriter.Options options, Writer writer) Writes a JSONObject out to the following output stream.static void
writeJSON
(JSONObject jsonObject, OutputStream out) Writes a JSONObject out to the following output stream.static void
writeJSON
(JSONObject jsonObject, Writer writer) Writes a JSONObject out to the following output stream.static void
writeJSON
(Object object, JSONWriter.Options options, OutputStream out) Writes a JSONObject out to the following output stream.static void
writeJSON
(Object object, JSONWriter.Options options, Writer writer) Writes a JSONObject out to the following output stream.static void
writeJSON
(Object object, OutputStream out) Writes a JSONObject out to the following output stream.static void
Writes a JSONObject out to the following output stream.static String
writeJSONString
(JSONObject jsonObject) Writes a JSONObject out to the following output stream.static String
writeJSONString
(JSONObject jsonObject, JSONWriter.Options options) Writes a JSONObject out to the following output stream.static String
writeJSONString
(Object object) Writes a JSONObject out to the following output stream.static String
writeJSONString
(Object object, JSONWriter.Options options) Writes a JSONObject out to the following output stream.writeString
(JSONObject jsonObject) Writes a JSONObject out to the following output stream.writeString
(Object object) Writes a JSONObject out to the following output stream.
-
Constructor Details
-
JSONWriter
Creates a new JSONWriter with a set of options to be used for every write.- Parameters:
options
- the writer options to use.- Since:
- 1.2.0
-
-
Method Details
-
writeJSON
public static void writeJSON(JSONObject jsonObject, JSONWriter.Options options, OutputStream out) throws IOException Writes a JSONObject out to the following output stream.- Parameters:
jsonObject
- the object to write.options
- the options to use for JSON output.out
- the output stream to write to.- Throws:
IOException
- if a write error occurs.- Since:
- 1.2.0
-
writeJSON
public static void writeJSON(JSONObject jsonObject, JSONWriter.Options options, Writer writer) throws IOException Writes a JSONObject out to the following output stream.- Parameters:
jsonObject
- the object to write.options
- the options to use for JSON output.writer
- the writer to write to.- Throws:
IOException
- if a write error occurs.- Since:
- 1.2.0
-
writeJSONString
public static String writeJSONString(JSONObject jsonObject, JSONWriter.Options options) throws IOException Writes a JSONObject out to the following output stream.- Parameters:
jsonObject
- the object to write.options
- the options to use for JSON output.- Returns:
- the JSONObject as a JSON string.
- Throws:
IOException
- if a write error occurs.- Since:
- 1.2.0
-
writeJSON
Writes a JSONObject out to the following output stream.- Parameters:
jsonObject
- the object to write.out
- the output stream to write to.- Throws:
IOException
- if a write error occurs.
-
writeJSON
Writes a JSONObject out to the following output stream.- Parameters:
jsonObject
- the object to write.writer
- the writer to write to.- Throws:
IOException
- if a write error occurs.
-
writeJSONString
Writes a JSONObject out to the following output stream.- Parameters:
jsonObject
- the object to write.- Returns:
- the JSONObject as a JSON string.
- Throws:
IOException
- if a write error occurs.
-
writeJSON
public static void writeJSON(Object object, JSONWriter.Options options, OutputStream out) throws IOException Writes a JSONObject out to the following output stream.- Parameters:
object
- the object to write.options
- the options to use for JSON output.out
- the output stream to write to.- Throws:
IOException
- if a write error occurs.- Since:
- 1.2.0
-
writeJSON
public static void writeJSON(Object object, JSONWriter.Options options, Writer writer) throws IOException Writes a JSONObject out to the following output stream.- Parameters:
object
- the object to write.options
- the options to use for JSON output.writer
- the writer to write to.- Throws:
IOException
- if a write error occurs.- Since:
- 1.2.0
-
writeJSONString
Writes a JSONObject out to the following output stream.- Parameters:
object
- the object to write.options
- the options to use for JSON output.- Returns:
- the JSONObject as a JSON string.
- Throws:
IOException
- if a write error occurs.- Since:
- 1.2.0
-
writeJSON
Writes a JSONObject out to the following output stream.- Parameters:
object
- the object to write.out
- the output stream to write to.- Throws:
IOException
- if a write error occurs.
-
writeJSON
Writes a JSONObject out to the following output stream.- Parameters:
object
- the object to write.writer
- the writer to write to.- Throws:
IOException
- if a write error occurs.
-
writeJSONString
Writes a JSONObject out to the following output stream.- Parameters:
object
- the object to write.- Returns:
- the JSONObject as a JSON string.
- Throws:
IOException
- if a write error occurs.
-
write
Writes a JSONObject out to the following output stream.- Parameters:
jsonObject
- the object to write.out
- the output stream to write to.- Throws:
IOException
- if a write error occurs.- Since:
- 1.2.0
-
write
Writes a JSONObject out to the following output stream.- Parameters:
jsonObject
- the object to write.writer
- the writer to write to.- Throws:
IOException
- if a write error occurs.- Since:
- 1.2.0
-
writeString
Writes a JSONObject out to the following output stream.- Parameters:
jsonObject
- the object to write.- Returns:
- the JSONObject as a JSON string.
- Throws:
IOException
- if a write error occurs.- Since:
- 1.2.0
-
write
Writes a JSONObject out to the following output stream.- Parameters:
object
- the object to write.out
- the output stream to write to.- Throws:
IOException
- if a write error occurs.- Since:
- 1.2.0
-
write
Writes a JSONObject out to the following output stream.- Parameters:
object
- the object to write.writer
- the writer to write to.- Throws:
IOException
- if a write error occurs.- Since:
- 1.2.0
-
writeString
Writes a JSONObject out to the following output stream.- Parameters:
object
- the object to write.- Returns:
- the JSONObject as a JSON string.
- Throws:
IOException
- if a write error occurs.- Since:
- 1.2.0
-