public class JsonPrettyGeneratorImpl
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
protected org.glassfish.json.JsonGeneratorImpl.Context |
currentContext |
protected java.io.Writer |
writer |
PRETTY_PRINTING| Constructor and Description |
|---|
JsonPrettyGeneratorImpl(java.io.OutputStream out) |
JsonPrettyGeneratorImpl(java.io.OutputStream out,
java.nio.charset.Charset encoding) |
JsonPrettyGeneratorImpl(java.io.Writer writer) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes this generator and frees any resources associated with it.
|
void |
flush()
Flushes the underlying output source.
|
JsonGenerator |
write(java.math.BigDecimal value)
Writes the specified value as a JSON number value within
the current array context.
|
JsonGenerator |
write(java.math.BigInteger value)
Writes the specified value as a JSON number value within
the current array context.
|
JsonGenerator |
write(boolean value)
Writes a JSON true or false value within the current array context.
|
JsonGenerator |
write(double value)
Writes the specified value as a JSON number value within the current
array context.
|
JsonGenerator |
write(int value)
Writes the specified value as a JSON number value within
the current array context.
|
JsonGenerator |
write(JsonValue value)
Writes the specified value as a JSON value within
the current array context.
|
JsonGenerator |
write(long value)
Writes the specified value as a JSON number value within
the current array context.
|
JsonGenerator |
write(java.lang.String value)
Writes the specified value as a JSON string value within
the current array context.
|
JsonGenerator |
write(java.lang.String name,
java.math.BigDecimal value)
Writes a JSON name/number value pair in the current object context.
|
JsonGenerator |
write(java.lang.String name,
java.math.BigInteger value)
Writes a JSON name/number value pair in the current object context.
|
JsonGenerator |
write(java.lang.String name,
boolean value)
Writes a JSON name/boolean value pair in the current object context.
|
JsonGenerator |
write(java.lang.String name,
double value)
Writes a JSON name/number value pair in the current object context.
|
JsonGenerator |
write(java.lang.String name,
int value)
Writes a JSON name/number value pair in the current object context.
|
JsonGenerator |
write(java.lang.String name,
JsonValue value)
Writes a JSON name/value pair in the current object context.
|
JsonGenerator |
write(java.lang.String name,
long value)
Writes a JSON name/number value pair in the current object context.
|
JsonGenerator |
write(java.lang.String name,
java.lang.String fieldValue)
Writes a JSON name/string value pair in the current object context.
|
protected void |
writeComma() |
JsonGenerator |
writeEnd()
Writes the end of the current context.
|
JsonGenerator |
writeNull()
Writes a JSON null value within the current array context.
|
JsonGenerator |
writeNull(java.lang.String name)
Writes a JSON name/null value pair in an current object context.
|
JsonGenerator |
writeStartArray()
Writes the JSON start array character.
|
JsonGenerator |
writeStartArray(java.lang.String name)
Writes the JSON name/start array character pair with in the current
object context.
|
JsonGenerator |
writeStartObject()
Writes the JSON start object character.
|
JsonGenerator |
writeStartObject(java.lang.String name)
Writes the JSON name/start object character pair in the current
object context.
|
protected final java.io.Writer writer
protected org.glassfish.json.JsonGeneratorImpl.Context currentContext
public JsonPrettyGeneratorImpl(java.io.Writer writer)
public JsonPrettyGeneratorImpl(java.io.OutputStream out)
public JsonPrettyGeneratorImpl(java.io.OutputStream out,
java.nio.charset.Charset encoding)
public JsonGenerator writeStartObject()
JsonGeneratorwriteStartObject in interface JsonGeneratorpublic JsonGenerator writeStartObject(java.lang.String name)
JsonGeneratorwriteStartObject in interface JsonGeneratorname - a name within the JSON name/object pair to be writtenpublic JsonGenerator writeStartArray()
JsonGeneratorwriteStartArray in interface JsonGeneratorpublic JsonGenerator writeStartArray(java.lang.String name)
JsonGeneratorwriteStartArray in interface JsonGeneratorname - a name within the JSON name/array pair to be writtenpublic JsonGenerator writeEnd()
JsonGeneratorwriteEnd in interface JsonGeneratorprotected void writeComma()
throws java.io.IOException
java.io.IOExceptionpublic void flush()
JsonGeneratorflush in interface java.io.Flushableflush in interface JsonGeneratorpublic JsonGenerator write(java.lang.String name, java.lang.String fieldValue)
JsonGeneratorwrite in interface JsonGeneratorname - a name in the JSON name/string pair to be written in
current JSON objectfieldValue - a value in the JSON name/string pair to be written in
current JSON objectpublic JsonGenerator write(java.lang.String name, int value)
JsonGeneratornew BigDecimal(value).toString() is used as the text value
for writing.write in interface JsonGeneratorname - a name in the JSON name/number pair to be written in
current JSON objectvalue - a value in the JSON name/number pair to be written in
current JSON objectpublic JsonGenerator write(java.lang.String name, long value)
JsonGeneratornew BigDecimal(value).toString() is used as the text
value for writing.write in interface JsonGeneratorname - a name in the JSON name/number pair to be written in
current JSON objectvalue - a value in the JSON name/number pair to be written in
current JSON objectpublic JsonGenerator write(java.lang.String name, double value)
JsonGeneratorBigDecimal.valueOf(double).toString()
is used as the text value for writing.write in interface JsonGeneratorname - a name in the JSON name/number pair to be written in
current JSON objectvalue - a value in the JSON name/number pair to be written in
current JSON objectpublic JsonGenerator write(java.lang.String name, java.math.BigInteger value)
JsonGeneratornew BigDecimal(value).toString()
is used as the text value for writing.write in interface JsonGeneratorname - a name in the JSON name/number pair to be written in
current JSON objectvalue - a value in the JSON name/number pair to be written in
current JSON objectpublic JsonGenerator write(java.lang.String name, java.math.BigDecimal value)
JsonGeneratortoString() is used as the text value for writing.write in interface JsonGeneratorname - a name in the JSON name/number pair to be written in
current JSON objectvalue - a value in the JSON name/number pair to be written in
current JSON objectpublic JsonGenerator write(java.lang.String name, boolean value)
JsonGeneratortrue value, otherwise
it writes the JSON false value.write in interface JsonGeneratorname - a name in the JSON name/boolean pair to be written in
current JSON objectvalue - a value in the JSON name/boolean pair to be written in
current JSON objectpublic JsonGenerator writeNull(java.lang.String name)
JsonGeneratorwriteNull in interface JsonGeneratorname - a name in the JSON name/null pair to be written in
current JSON objectpublic JsonGenerator write(JsonValue value)
JsonGeneratorwrite in interface JsonGeneratorvalue - a value to be written in current JSON arraypublic JsonGenerator write(java.lang.String name, JsonValue value)
JsonGeneratorwrite in interface JsonGeneratorname - a name in the JSON name/value pair to be written in
current JSON objectvalue - a value in the JSON name/value pair to be written in
current JSON objectpublic JsonGenerator write(java.lang.String value)
JsonGeneratorwrite in interface JsonGeneratorvalue - a value to be written in current JSON arraypublic JsonGenerator write(int value)
JsonGeneratornew BigDecimal(value).toString()
is used as the text value for writing.write in interface JsonGeneratorvalue - a value to be written in current JSON arraypublic JsonGenerator write(long value)
JsonGeneratornew BigDecimal(value).toString()
is used as the text value for writing.write in interface JsonGeneratorvalue - a value to be written in current JSON arraypublic JsonGenerator write(double value)
JsonGeneratorBigDecimal.valueOf(value).toString()
is used as the text value for writing.write in interface JsonGeneratorvalue - a value to be written in current JSON arraypublic JsonGenerator write(java.math.BigInteger value)
JsonGeneratornew BigDecimal(value).toString()
is used as the text value for writing.write in interface JsonGeneratorvalue - a value to be written in current JSON arrayJsonNumberpublic JsonGenerator write(java.math.BigDecimal value)
JsonGeneratortoString()
is used as the the text value for writing.write in interface JsonGeneratorvalue - a value to be written in current JSON arrayJsonNumberpublic JsonGenerator write(boolean value)
JsonGeneratortrue value,
otherwise it writes the JSON false value.write in interface JsonGeneratorvalue - a boolean valuepublic JsonGenerator writeNull()
JsonGeneratorwriteNull in interface JsonGeneratorpublic void close()
JsonGeneratorclose in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in interface JsonGeneratorCopyright © 2013 Oracle. All Rights Reserved.