Package org.glassfish.json
Class JsonPrettyGeneratorImpl
- java.lang.Object
-
- org.glassfish.json.JsonGeneratorImpl
-
- org.glassfish.json.JsonPrettyGeneratorImpl
-
- All Implemented Interfaces:
java.io.Closeable
,java.io.Flushable
,java.lang.AutoCloseable
,JsonGenerator
public class JsonPrettyGeneratorImpl extends JsonGeneratorImpl
-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.String
INDENT
private int
indentLevel
-
Fields inherited from interface javax.json.stream.JsonGenerator
PRETTY_PRINTING
-
-
Constructor Summary
Constructors Constructor Description JsonPrettyGeneratorImpl(java.io.OutputStream out, java.nio.charset.Charset encoding, BufferPool bufferPool)
JsonPrettyGeneratorImpl(java.io.OutputStream out, BufferPool bufferPool)
JsonPrettyGeneratorImpl(java.io.Writer writer, BufferPool bufferPool)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
writeColon()
protected void
writeComma()
JsonGenerator
writeEnd()
Writes the end of the current context.private void
writeIndent()
private void
writeNewLine()
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.-
Methods inherited from class org.glassfish.json.JsonGeneratorImpl
close, flush, flushBuffer, isCommaAllowed, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, writeChar, writeEscapedString, writeInt, writeKey, writeNull, writeNull, writeString, writeString
-
-
-
-
Field Detail
-
indentLevel
private int indentLevel
-
INDENT
private static final java.lang.String INDENT
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
JsonPrettyGeneratorImpl
public JsonPrettyGeneratorImpl(java.io.Writer writer, BufferPool bufferPool)
-
JsonPrettyGeneratorImpl
public JsonPrettyGeneratorImpl(java.io.OutputStream out, BufferPool bufferPool)
-
JsonPrettyGeneratorImpl
public JsonPrettyGeneratorImpl(java.io.OutputStream out, java.nio.charset.Charset encoding, BufferPool bufferPool)
-
-
Method Detail
-
writeStartObject
public JsonGenerator writeStartObject()
Description copied from interface:JsonGenerator
Writes the JSON start object character. It starts a new child object context within which JSON name/value pairs can be written to the object. This method is valid only in an array context, field context or in no context (when a context is not yet started). This method can only be called once in no context.- Specified by:
writeStartObject
in interfaceJsonGenerator
- Overrides:
writeStartObject
in classJsonGeneratorImpl
- Returns:
- this generator
-
writeStartObject
public JsonGenerator writeStartObject(java.lang.String name)
Description copied from interface:JsonGenerator
Writes the JSON name/start object character pair in the current object context. It starts a new child object context within which JSON name/value pairs can be written to the object.- Specified by:
writeStartObject
in interfaceJsonGenerator
- Overrides:
writeStartObject
in classJsonGeneratorImpl
- Parameters:
name
- a name within the JSON name/object pair to be written- Returns:
- this generator
-
writeStartArray
public JsonGenerator writeStartArray()
Description copied from interface:JsonGenerator
Writes the JSON start array character. It starts a new child array context within which JSON values can be written to the array. This method is valid only in an array context, field context or in no context (when a context is not yet started). This method can only be called once in no context.- Specified by:
writeStartArray
in interfaceJsonGenerator
- Overrides:
writeStartArray
in classJsonGeneratorImpl
- Returns:
- this generator
-
writeStartArray
public JsonGenerator writeStartArray(java.lang.String name)
Description copied from interface:JsonGenerator
Writes the JSON name/start array character pair with in the current object context. It starts a new child array context within which JSON values can be written to the array.- Specified by:
writeStartArray
in interfaceJsonGenerator
- Overrides:
writeStartArray
in classJsonGeneratorImpl
- Parameters:
name
- a name within the JSON name/array pair to be written- Returns:
- this generator
-
writeEnd
public JsonGenerator writeEnd()
Description copied from interface:JsonGenerator
Writes the end of the current context. If the current context is an array context, this method writes the end-of-array character (']'). If the current context is an object context, this method writes the end-of-object character ('}'). After writing the end of the current context, the parent context becomes the new current context. If parent context is field context, it is closed.- Specified by:
writeEnd
in interfaceJsonGenerator
- Overrides:
writeEnd
in classJsonGeneratorImpl
- Returns:
- this generator
-
writeIndent
private void writeIndent()
-
writeComma
protected void writeComma()
- Overrides:
writeComma
in classJsonGeneratorImpl
-
writeColon
protected void writeColon()
- Overrides:
writeColon
in classJsonGeneratorImpl
-
writeNewLine
private void writeNewLine()
-
-