public final class WriterUtil
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static boolean |
isSimpleValue(java.lang.Object value)
Is this value a simple value for the purposes of writing a JSON structure.
|
static void |
writeBoolean(boolean value,
java.lang.Appendable writer)
Write the given
boolean to the given Appendable. |
static void |
writeBoolean(java.lang.Boolean value,
java.lang.Appendable writer)
Write the given
Boolean to the given Appendable. |
static void |
writeDouble(double d,
java.lang.Appendable writer)
Write the given
double to the given Appendable. |
static void |
writeEnum(java.lang.Enum<?> value,
java.lang.Appendable writer)
Write the given
Enum to the given Appendable as a
String. |
static void |
writeJSONAppendable(JSONAppendable value,
java.lang.Appendable writer)
Write the
JSONAppendable as a JSON value to a writer. |
static void |
writeJSONString(JSONString value,
java.lang.Appendable writer)
Write the contents of the
JSONString as a JSON value to a writer. |
static void |
writeLong(long number,
java.lang.Appendable writer)
Write the given
long to the given Appendable. |
static void |
writeNull(java.lang.Appendable writer)
Write the value
null to the given Appendable. |
static void |
writeNumber(java.lang.Number number,
java.lang.Appendable writer)
Write the given
Number to the given Appendable. |
static void |
writeSimpleValue(java.lang.Object value,
java.lang.Appendable writer)
Write the contents of the
Object as JSON text to a writer. |
static void |
writeString(java.lang.CharSequence string,
java.lang.Appendable w)
Produce a string in double quotes with backslash sequences in all the
right places.
|
public static boolean isSimpleValue(java.lang.Object value)
value - the Object value to be testedtrue if this value is a simple JSON value, otherwise
falsepublic static void writeSimpleValue(java.lang.Object value,
java.lang.Appendable writer)
throws JSONException
Object as JSON text to a writer.
Warning: This method assumes that the data structure is acyclical.
value - The value to be writtenwriter - Writes the serialized JSONJSONException - there was a problem writing the Objectpublic static void writeJSONAppendable(JSONAppendable value, java.lang.Appendable writer) throws JSONException
JSONAppendable as a JSON value to a writer.
Warning: This method assumes that the data structure is acyclical.
value - The JSONAppendable to be writtenwriter - Writes the serialized JSONJSONException - there was a problem writing the JSONAppendablepublic static void writeJSONString(JSONString value, java.lang.Appendable writer) throws JSONException
JSONString as a JSON value to a writer.
Warning: This method assumes that the data structure is acyclical.
value - The JSONString to be writtenwriter - Writes the serialized JSONJSONException - there was a problem writing the JSONStringpublic static void writeEnum(java.lang.Enum<?> value,
java.lang.Appendable writer)
throws JSONException
Enum to the given Appendable as a
String.value - An Enumwriter - The Appendable to which the Enum value is
writtenJSONException - there was a problem writing the Enumpublic static void writeString(java.lang.CharSequence string,
java.lang.Appendable w)
throws JSONException
string - A character sequence to be quotedw - the Appendable to which the quoted character sequence
will be writtenJSONException - there was a problem writing to the Appendablepublic static void writeDouble(double d,
java.lang.Appendable writer)
throws JSONException
double to the given Appendable.d - A doublewriter - The Appendable to which the double value is writtenJSONException - there was a problem writing the doublepublic static void writeLong(long number,
java.lang.Appendable writer)
throws JSONException
long to the given Appendable.number - A longwriter - The Appendable to which the number value is writtenJSONException - there was a problem writing the longpublic static void writeNumber(java.lang.Number number,
java.lang.Appendable writer)
throws JSONException
Number to the given Appendable.number - A Numberwriter - The Appendable to which the number value is writtenJSONException - there was a problem writing the Numberpublic static void writeBoolean(java.lang.Boolean value,
java.lang.Appendable writer)
throws JSONException
Boolean to the given Appendable.value - A Booleanwriter - The Appendable to which the boolean value is writtenJSONException - there was a problem writing the Booleanpublic static void writeBoolean(boolean value,
java.lang.Appendable writer)
throws JSONException
boolean to the given Appendable.value - A booleanwriter - The Appendable to which the boolean value is writtenJSONException - there was a problem writing the booleanpublic static void writeNull(java.lang.Appendable writer)
throws JSONException
null to the given Appendable.writer - The Appendable to which the null value is writtenJSONException - there was a problem writing null