Package org.bson

Class BsonDocumentWriter

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable, BsonWriter

    public class BsonDocumentWriter
    extends AbstractBsonWriter
    A BsonWriter implementation that writes to an instance of BsonDocument. This can be used to encode an object into a BsonDocument using an Encoder.
    Since:
    3.0
    See Also:
    BsonDocument, Encoder
    • 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)
      • 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.