Package org.bson
Class BsonDocumentWriter
- java.lang.Object
-
- org.bson.AbstractBsonWriter
-
- org.bson.BsonDocumentWriter
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
,BsonWriter
public class BsonDocumentWriter extends AbstractBsonWriter
ABsonWriter
implementation that writes to an instance ofBsonDocument
. This can be used to encode an object into aBsonDocument
using anEncoder
.- Since:
- 3.0
- See Also:
BsonDocument
,Encoder
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.bson.AbstractBsonWriter
AbstractBsonWriter.State
-
-
Constructor Summary
Constructors Constructor Description BsonDocumentWriter(BsonDocument document)
Construct a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
doWriteBoolean(boolean value)
void
doWriteNull()
void
doWriteObjectId(ObjectId value)
void
doWriteRegularExpression(BsonRegularExpression value)
void
doWriteString(java.lang.String value)
void
doWriteSymbol(java.lang.String value)
void
doWriteTimestamp(BsonTimestamp value)
void
doWriteUndefined()
void
flush()
Flushes any pending data to the output destination.BsonDocument
getDocument()
Gets the document that the writer is writing to.-
Methods inherited from class org.bson.AbstractBsonWriter
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
-
-
-
-
Constructor Detail
-
BsonDocumentWriter
public BsonDocumentWriter(BsonDocument document)
Construct a new instance.- Parameters:
document
- the document to write to
-
-
Method Detail
-
getDocument
public BsonDocument getDocument()
Gets the document that the writer is writing to.- Returns:
- the document
-
doWriteBoolean
public void doWriteBoolean(boolean value)
-
doWriteNull
public void doWriteNull()
-
doWriteObjectId
public void doWriteObjectId(ObjectId value)
-
doWriteRegularExpression
public void doWriteRegularExpression(BsonRegularExpression value)
-
doWriteString
public void doWriteString(java.lang.String value)
-
doWriteSymbol
public void doWriteSymbol(java.lang.String value)
-
doWriteTimestamp
public void doWriteTimestamp(BsonTimestamp value)
-
doWriteUndefined
public void doWriteUndefined()
-
flush
public void flush()
Description copied from interface:BsonWriter
Flushes any pending data to the output destination.
-
-