class JsonGeneratorImpl extends java.lang.Object implements JsonGenerator
| Modifier and Type | Class and Description |
|---|---|
private static class |
JsonGeneratorImpl.Context |
private static class |
JsonGeneratorImpl.Scope |
| Modifier and Type | Field and Description |
|---|---|
private char[] |
buf |
private BufferPool |
bufferPool |
private JsonGeneratorImpl.Context |
currentContext |
private static char[] |
DIGIT_ONES |
private static char[] |
DIGIT_TENS |
private static char[] |
DIGITS
All possible chars for representing a number as a String
|
private static int[] |
INT_CHARS_SIZE_TABLE |
private static char[] |
INT_MIN_VALUE_CHARS |
private int |
len |
private java.util.Deque<JsonGeneratorImpl.Context> |
stack |
private static java.nio.charset.Charset |
UTF_8 |
private java.io.Writer |
writer |
PRETTY_PRINTING| Constructor and Description |
|---|
JsonGeneratorImpl(java.io.OutputStream out,
BufferPool bufferPool) |
JsonGeneratorImpl(java.io.OutputStream out,
java.nio.charset.Charset encoding,
BufferPool bufferPool) |
JsonGeneratorImpl(java.io.Writer writer,
BufferPool bufferPool) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes this generator and frees any resources associated with it.
|
private static void |
fillIntChars(int i,
char[] buf,
int index)
Places characters representing the integer i into the
character array buf.
|
void |
flush()
Flushes the underlying output source.
|
(package private) void |
flushBuffer() |
private static int |
stringSize(int x) |
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.
|
(package private) void |
writeChar(char c) |
protected void |
writeComma() |
JsonGenerator |
writeEnd()
Writes the end of the current context.
|
(package private) void |
writeEscapedString(java.lang.String string) |
(package private) void |
writeInt(int num) |
private JsonGenerator |
writeName(java.lang.String name) |
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.
|
(package private) void |
writeString(java.lang.String str) |
(package private) void |
writeString(java.lang.String str,
int begin,
int end) |
private void |
writeValue(java.lang.String value) |
private void |
writeValue(java.lang.String name,
java.lang.String value) |
private static final java.nio.charset.Charset UTF_8
private static final char[] INT_MIN_VALUE_CHARS
private static final int[] INT_CHARS_SIZE_TABLE
private static final char[] DIGIT_TENS
private static final char[] DIGIT_ONES
private static final char[] DIGITS
private final BufferPool bufferPool
private final java.io.Writer writer
private JsonGeneratorImpl.Context currentContext
private final java.util.Deque<JsonGeneratorImpl.Context> stack
private final char[] buf
private int len
JsonGeneratorImpl(java.io.Writer writer,
BufferPool bufferPool)
JsonGeneratorImpl(java.io.OutputStream out,
BufferPool bufferPool)
JsonGeneratorImpl(java.io.OutputStream out,
java.nio.charset.Charset encoding,
BufferPool bufferPool)
public void flush()
JsonGeneratorflush in interface java.io.Flushableflush in interface JsonGeneratorpublic 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 writtenprivate JsonGenerator writeName(java.lang.String name)
public 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 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 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 JsonGeneratorprivate void writeValue(java.lang.String value)
private void writeValue(java.lang.String name,
java.lang.String value)
public JsonGenerator writeEnd()
JsonGeneratorwriteEnd in interface JsonGeneratorprotected void writeComma()
public void close()
JsonGeneratorclose in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in interface JsonGeneratorvoid writeEscapedString(java.lang.String string)
void writeString(java.lang.String str,
int begin,
int end)
void writeString(java.lang.String str)
void writeChar(char c)
void writeInt(int num)
void flushBuffer()
private static int stringSize(int x)
private static void fillIntChars(int i,
char[] buf,
int index)