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
ABsonWriterimplementation that writes to an instance ofBsonDocument. This can be used to encode an object into aBsonDocumentusing 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 voiddoWriteBoolean(boolean value)voiddoWriteNull()voiddoWriteObjectId(ObjectId value)voiddoWriteRegularExpression(BsonRegularExpression value)voiddoWriteString(java.lang.String value)voiddoWriteSymbol(java.lang.String value)voiddoWriteTimestamp(BsonTimestamp value)voiddoWriteUndefined()voidflush()Flushes any pending data to the output destination.BsonDocumentgetDocument()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:BsonWriterFlushes any pending data to the output destination.
-
-