Package org.glassfish.json
Class JsonWriterImpl
- java.lang.Object
-
- org.glassfish.json.JsonWriterImpl
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable,JsonWriter
class JsonWriterImpl extends java.lang.Object implements JsonWriter
JsonWriter impl using generator.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classJsonWriterImpl.NoFlushOutputStream
-
Field Summary
Fields Modifier and Type Field Description private JsonGeneratorImplgeneratorprivate JsonWriterImpl.NoFlushOutputStreamosprivate static java.nio.charset.CharsetUTF_8private booleanwriteDone
-
Constructor Summary
Constructors Constructor Description JsonWriterImpl(java.io.OutputStream out, boolean prettyPrinting, BufferPool bufferPool)JsonWriterImpl(java.io.OutputStream out, java.nio.charset.Charset charset, boolean prettyPrinting, BufferPool bufferPool)JsonWriterImpl(java.io.OutputStream out, BufferPool bufferPool)JsonWriterImpl(java.io.Writer writer, boolean prettyPrinting, BufferPool bufferPool)JsonWriterImpl(java.io.Writer writer, BufferPool bufferPool)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Closes this JSON writer and frees any resources associated with the writer.voidwrite(JsonStructure value)voidwriteArray(JsonArray array)Writes the specified JSONarrayto the output source.voidwriteObject(JsonObject object)Writes the specified JSONobjectto the output source.
-
-
-
Field Detail
-
UTF_8
private static final java.nio.charset.Charset UTF_8
-
generator
private final JsonGeneratorImpl generator
-
writeDone
private boolean writeDone
-
os
private final JsonWriterImpl.NoFlushOutputStream os
-
-
Constructor Detail
-
JsonWriterImpl
JsonWriterImpl(java.io.Writer writer, BufferPool bufferPool)
-
JsonWriterImpl
JsonWriterImpl(java.io.Writer writer, boolean prettyPrinting, BufferPool bufferPool)
-
JsonWriterImpl
JsonWriterImpl(java.io.OutputStream out, BufferPool bufferPool)
-
JsonWriterImpl
JsonWriterImpl(java.io.OutputStream out, boolean prettyPrinting, BufferPool bufferPool)
-
JsonWriterImpl
JsonWriterImpl(java.io.OutputStream out, java.nio.charset.Charset charset, boolean prettyPrinting, BufferPool bufferPool)
-
-
Method Detail
-
writeArray
public void writeArray(JsonArray array)
Description copied from interface:JsonWriterWrites the specified JSONarrayto the output source. This method needs to be called only once for a writer instance.- Specified by:
writeArrayin interfaceJsonWriter- Parameters:
array- JSON array that is to be written to the output source
-
writeObject
public void writeObject(JsonObject object)
Description copied from interface:JsonWriterWrites the specified JSONobjectto the output source. This method needs to be called only once for a writer instance.- Specified by:
writeObjectin interfaceJsonWriter- Parameters:
object- JSON object that is to be written to the output source
-
write
public void write(JsonStructure value)
Description copied from interface:JsonWriterWrites the specified JSONobjectorarrayto the output source. This method needs to be called only once for a writer instance.- Specified by:
writein interfaceJsonWriter- Parameters:
value- JSON array or object that is to be written to the output source
-
close
public void close()
Description copied from interface:JsonWriterCloses this JSON writer and frees any resources associated with the writer. This method closes the underlying output source.- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Specified by:
closein interfaceJsonWriter
-
-