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 class
JsonWriterImpl.NoFlushOutputStream
-
Field Summary
Fields Modifier and Type Field Description private JsonGeneratorImpl
generator
private JsonWriterImpl.NoFlushOutputStream
os
private boolean
writeDone
-
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 void
close()
void
write(JsonStructure value)
void
write(JsonValue value)
Writes the specifiedJsonValue
to the output source.void
writeArray(JsonArray array)
Writes the specified JSONarray
to the output source.void
writeObject(JsonObject object)
Writes the specified JSONobject
to the output source.
-
-
-
Field Detail
-
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:JsonWriter
Writes the specified JSONarray
to the output source. This method needs to be called only once for a writer instance.- Specified by:
writeArray
in interfaceJsonWriter
- Parameters:
array
- JSON array that is to be written to the output source
-
writeObject
public void writeObject(JsonObject object)
Description copied from interface:JsonWriter
Writes the specified JSONobject
to the output source. This method needs to be called only once for a writer instance.- Specified by:
writeObject
in interfaceJsonWriter
- Parameters:
object
- JSON object that is to be written to the output source
-
write
public void write(JsonStructure value)
Description copied from interface:JsonWriter
Writes the specified JSONobject
orarray
to the output source. This method needs to be called only once for a writer instance.- Specified by:
write
in interfaceJsonWriter
- Parameters:
value
- JSON array or object that is to be written to the output source
-
write
public void write(JsonValue value)
Description copied from interface:JsonWriter
Writes the specifiedJsonValue
to the output source. method needs to be called only once for a write instance.- Specified by:
write
in interfaceJsonWriter
- Parameters:
value
- aJsonValue
to be written to the output source
-
close
public void close()
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Specified by:
close
in interfaceJsonWriter
-
-