public class JsonWriter extends AbstractBsonWriter
BsonWriter
implementation that outputs a JSON representation of BSON.Modifier and Type | Class and Description |
---|---|
class |
JsonWriter.Context
The context for the writer, inheriting all the values from
AbstractBsonWriter.Context , and additionally providing
settings for the indentation level and whether there are any child elements at this level. |
AbstractBsonWriter.State
Constructor and Description |
---|
JsonWriter(java.io.Writer writer)
Creates a new instance which uses
writer to write JSON to. |
JsonWriter(java.io.Writer writer,
JsonWriterSettings settings)
Creates a new instance which uses
writer to write JSON to and uses the given settings. |
Modifier and Type | Method and Description |
---|---|
void |
doWriteBoolean(boolean value)
Handles the logic of writing a boolean value
|
void |
doWriteNull()
Handles the logic of writing a Null value
|
void |
doWriteObjectId(ObjectId objectId)
Handles the logic of writing an ObjectId
|
void |
doWriteRegularExpression(BsonRegularExpression regularExpression)
Handles the logic of writing a regular expression
|
void |
doWriteString(java.lang.String value)
Handles the logic of writing a String
|
void |
doWriteSymbol(java.lang.String value)
Handles the logic of writing a Symbol
|
void |
doWriteTimestamp(BsonTimestamp value)
Handles the logic of writing a timestamp
|
void |
doWriteUndefined()
Handles the logic of writing an Undefined value
|
void |
flush()
Flushes any pending data to the output destination.
|
java.io.Writer |
getWriter()
Gets the
Writer . |
boolean |
isTruncated()
Return true if the output has been truncated due to exceeding the length specified in
JsonWriterSettings.maxLength . |
close, pipe, pipe, writeBinaryData, writeBinaryData, writeBoolean, writeBoolean, writeDateTime, writeDateTime, writeDBPointer, writeDBPointer, writeDecimal128, writeDecimal128, writeDouble, writeDouble, writeEndArray, writeEndDocument, writeInt32, writeInt32, writeInt64, writeInt64, writeJavaScript, writeJavaScript, writeJavaScriptWithScope, writeJavaScriptWithScope, writeMaxKey, writeMaxKey, writeMinKey, writeMinKey, writeName, writeNull, writeNull, writeObjectId, writeObjectId, writeRegularExpression, writeRegularExpression, writeStartArray, writeStartArray, writeStartDocument, writeStartDocument, writeString, writeString, writeSymbol, writeSymbol, writeTimestamp, writeTimestamp, writeUndefined, writeUndefined
public JsonWriter(java.io.Writer writer)
writer
to write JSON to.writer
- the writer to write JSON to.public JsonWriter(java.io.Writer writer, JsonWriterSettings settings)
writer
to write JSON to and uses the given settings.writer
- the writer to write JSON to.settings
- the settings to apply to this writer.public java.io.Writer getWriter()
Writer
.public void doWriteBoolean(boolean value)
AbstractBsonWriter
value
- the boolean
value to writepublic void doWriteNull()
AbstractBsonWriter
public void doWriteObjectId(ObjectId objectId)
AbstractBsonWriter
objectId
- the ObjectId
value to writepublic void doWriteRegularExpression(BsonRegularExpression regularExpression)
AbstractBsonWriter
regularExpression
- the BsonRegularExpression
value to writepublic void doWriteString(java.lang.String value)
AbstractBsonWriter
value
- the String
value to writepublic void doWriteSymbol(java.lang.String value)
AbstractBsonWriter
value
- the boolean
value to writepublic void doWriteTimestamp(BsonTimestamp value)
AbstractBsonWriter
value
- the BsonTimestamp
value to writepublic void doWriteUndefined()
AbstractBsonWriter
public void flush()
BsonWriter
public boolean isTruncated()
JsonWriterSettings.maxLength
.JsonWriterSettings.maxLength
Copyright © 2010 - 2020 Adobe. All Rights Reserved