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
Nested ClassesModifier and TypeClassDescriptionstatic classThe JSON export options to pass to the writer methods. -
Constructor Summary
ConstructorsConstructorDescriptionJSONWriter(JSONWriter.Options options) Creates a new JSONWriter with a set of options to be used for every write. -
Method Summary
Modifier and TypeMethodDescriptionvoidwrite(JSONObject jsonObject, OutputStream out) Writes a JSONObject out to the following output stream.voidwrite(JSONObject jsonObject, Writer writer) Writes a JSONObject out to the following output stream.voidwrite(Object object, OutputStream out) Writes a JSONObject out to the following output stream.voidWrites a JSONObject out to the following output stream.static voidwriteJSON(JSONObject jsonObject, JSONWriter.Options options, OutputStream out) Writes a JSONObject out to the following output stream.static voidwriteJSON(JSONObject jsonObject, JSONWriter.Options options, Writer writer) Writes a JSONObject out to the following output stream.static voidwriteJSON(JSONObject jsonObject, OutputStream out) Writes a JSONObject out to the following output stream.static voidwriteJSON(JSONObject jsonObject, Writer writer) Writes a JSONObject out to the following output stream.static voidwriteJSON(Object object, JSONWriter.Options options, OutputStream out) Writes a JSONObject out to the following output stream.static voidwriteJSON(Object object, JSONWriter.Options options, Writer writer) Writes a JSONObject out to the following output stream.static voidwriteJSON(Object object, OutputStream out) Writes a JSONObject out to the following output stream.static voidWrites a JSONObject out to the following output stream.static StringwriteJSONString(JSONObject jsonObject) Writes a JSONObject out to the following output stream.static StringwriteJSONString(JSONObject jsonObject, JSONWriter.Options options) Writes a JSONObject out to the following output stream.static StringwriteJSONString(Object object) Writes a JSONObject out to the following output stream.static StringwriteJSONString(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
-