java.io.FlushableContentsJsonWriterpublic class JsonWriter
extends java.lang.Object
implements java.io.Flushable
Created: 2008. 06. 12 PM 8:20:54
| Constructor | Description |
|---|---|
JsonWriter(java.io.Writer writer) |
Instantiates a new JsonWriter.
|
JsonWriter(java.io.Writer writer,
boolean prettyPrint) |
Instantiates a new JsonWriter.
|
JsonWriter(java.io.Writer writer,
java.lang.String indentString) |
Instantiates a new JsonWriter.
|
| Modifier and Type | Method | Description |
|---|---|---|
void |
close() |
Closes the writer.
|
protected void |
closeCurlyBracket() |
Close brace.
|
protected void |
closeSquareBracket() |
Close square bracket.
|
void |
flush() |
|
protected void |
indent() |
Write a tab character to a character stream.
|
protected void |
nextLine() |
Write a new line character to a character stream.
|
protected void |
openCurlyBracket() |
Open brace.
|
protected void |
openSquareBracket() |
Open square bracket.
|
static java.lang.String |
stringify(java.lang.Object object) |
Converts an object to a JSON formatted string.
|
static java.lang.String |
stringify(java.lang.Object object,
boolean prettyPrint) |
Converts an object to a JSON formatted string.
|
static java.lang.String |
stringify(java.lang.Object object,
java.lang.String indentString) |
Converts an object to a JSON formatted string.
|
void |
write(java.lang.Object object) |
Write an object to a character stream.
|
protected void |
writeBoolean(java.lang.Boolean value) |
Writes a
Boolean object to a character stream. |
protected void |
writeComma() |
Write a comma character to a character stream.
|
protected void |
writeName(java.lang.String name) |
Writes a key name to a character stream.
|
protected void |
writeNull() |
Write a string "null" to a character stream.
|
protected void |
writeNumber(java.lang.Number value) |
Writes a
Number object to a character stream. |
protected void |
writeString(java.lang.String value) |
Writes a string to a character stream.
|
public JsonWriter(java.io.Writer writer)
writer - the character-output streampublic JsonWriter(java.io.Writer writer,
boolean prettyPrint)
writer - the character-output streamprettyPrint - enables or disables pretty-printingpublic JsonWriter(java.io.Writer writer,
java.lang.String indentString)
writer - the character-output streamindentString - the string that should be used for indentation when pretty-printing is enabledpublic void write(java.lang.Object object)
throws java.io.IOException,
java.lang.reflect.InvocationTargetException
object - the object to write to a character-output stream.java.io.IOException - an I/O error occurs.java.lang.reflect.InvocationTargetException - the invocation target exceptionprotected void indent()
throws java.io.IOException
java.io.IOException - an I/O error occursprotected void writeName(java.lang.String name)
throws java.io.IOException
name - the string to write to a character-output streamjava.io.IOException - an I/O error occursprotected void writeString(java.lang.String value)
throws java.io.IOException
value is null, write a null string ("").value - the string to write to a character-output streamjava.io.IOException - an I/O error occursprotected void writeBoolean(java.lang.Boolean value)
throws java.io.IOException
Boolean object to a character stream.value - a Boolean object to write to a character-output streamjava.io.IOException - an I/O error occursprotected void writeNumber(java.lang.Number value)
throws java.io.IOException
Number object to a character stream.value - a Number object to write to a character-output streamjava.io.IOException - an I/O error occursprotected void writeNull()
throws java.io.IOException
java.io.IOException - an I/O error occursprotected void writeComma()
throws java.io.IOException
java.io.IOException - an I/O error occursprotected void nextLine()
throws java.io.IOException
java.io.IOException - an I/O error occursprotected void openCurlyBracket()
throws java.io.IOException
java.io.IOException - an I/O error occursprotected void closeCurlyBracket()
throws java.io.IOException
java.io.IOException - an I/O error occursprotected void openSquareBracket()
throws java.io.IOException
java.io.IOException - an I/O error occursprotected void closeSquareBracket()
throws java.io.IOException
java.io.IOException - an I/O error occurspublic void flush()
throws java.io.IOException
flush in interface java.io.Flushablejava.io.IOExceptionpublic void close()
throws java.io.IOException
java.io.IOException - an I/O error occurspublic static java.lang.String stringify(java.lang.Object object)
object - an object to convert to a JSON formatted stringpublic static java.lang.String stringify(java.lang.Object object,
boolean prettyPrint)
object - an object to convert to a JSON formatted stringprettyPrint - enables or disables pretty-printingpublic static java.lang.String stringify(java.lang.Object object,
java.lang.String indentString)
object - an object to convert to a JSON formatted stringindentString - the string that should be used for indentation when pretty-printing is enabledCopyright © 2008–2018 The Aspectran Project. All rights reserved.