Package org.bson

Class AbstractBsonWriter

    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      protected boolean abortPipe()
      Return true if the current execution of the pipe method should be aborted.
      protected void  methodName, AbstractBsonWriter.State... validStates)
      Checks the writer is in the correct state.
      protected boolean checkState​(AbstractBsonWriter.State[] validStates)
      Checks if this writer's current state is in the list of given states.
      void close()  
      protected abstract void doWriteBinaryData​(BsonBinary value)
      Handles the logic of writing a BsonBinary value
      protected abstract void doWriteBoolean​(boolean value)
      Handles the logic of writing a boolean value
      protected abstract void doWriteDateTime​(long value)
      Handles the logic of writing a date time value
      protected abstract void doWriteDBPointer​(BsonDbPointer value)
      Handles the logic of writing a DbPointer value
      protected abstract void doWriteDecimal128​(Decimal128 value)
      Handles the logic of writing a Decimal128 value
      protected abstract void doWriteDouble​(double value)
      Handles the logic of writing a Double value
      protected abstract void doWriteEndArray()
      Handles the logic of writing the end of an array
      protected abstract void doWriteEndDocument()
      Handles the logic of writing the end of a document
      protected abstract void doWriteInt32​(int value)
      Handles the logic of writing an int32 value
      protected abstract void doWriteInt64​(long value)
      Handles the logic of writing an int64 value
      protected abstract void  value)
      Handles the logic of writing a JavaScript function
      protected abstract void  value)
      Handles the logic of writing a scoped JavaScript function
      protected abstract void doWriteMaxKey()
      Handles the logic of writing a Max key
      protected abstract void doWriteMinKey()
      Handles the logic of writing a Min key
      protected void  name)
      Handles the logic of writing the element name.
      protected abstract void doWriteNull()
      Handles the logic of writing a Null value
      protected abstract void doWriteObjectId​(ObjectId value)
      Handles the logic of writing an ObjectId
      protected abstract void doWriteRegularExpression​(BsonRegularExpression value)
      Handles the logic of writing a regular expression
      protected abstract void doWriteStartArray()
      Handles the logic to start writing an array
      protected abstract void doWriteStartDocument()
      Handles the logic to start writing a document
      protected abstract void  value)
      Handles the logic of writing a String
      protected abstract void  value)
      Handles the logic of writing a Symbol
      protected abstract void doWriteTimestamp​(BsonTimestamp value)
      Handles the logic of writing a timestamp
      protected abstract void doWriteUndefined()
      Handles the logic of writing an Undefined value
      protected AbstractBsonWriter.Context getContext()
      Get the context, which will indicate which state the writer is in, for example which part of a document it's currently writing.
      protected getName()
      The name of the field being written.
      protected AbstractBsonWriter.State getNextState()
      Returns the next valid state for this writer.
      protected AbstractBsonWriter.State getState()
      Gets the current state of this writer.
      protected boolean isClosed()
      Returns whether this writer has been closed.
      void pipe​(BsonReader reader)
      Reads a single document from a BsonReader and writes it to this.
      void pipe​(BsonReader reader, <BsonElement> extraElements)
      Reads a single document from the given BsonReader and writes it to this, appending the given extra elements to the document.
      protected void <BsonElement> extraElements)
      Pipe a list of extra element to this writer
      protected void setContext​(AbstractBsonWriter.Context context)
      Set the context, which will indicate which state the writer is in, for example which part of a document it's currently writing.
      protected void setState​(AbstractBsonWriter.State state)
      Sets the current state of the writer.
      protected void  methodName, BsonContextType actualContextType, BsonContextType... validContextTypes)
      Throws an InvalidOperationException when the method called is not valid for the current ContextType.
      protected void  methodName, AbstractBsonWriter.State... validStates)
      Throws a BsonInvalidOperationException when the method called is not valid for the current state.
      void  name, BsonBinary binary)
      Writes a BSON Binary data element to the writer.
      void writeBinaryData​(BsonBinary binary)
      Writes a BSON Binary data element to the writer.
      void writeBoolean​(boolean value)
      Writes a BSON Boolean to the writer.
      void  name, boolean value)
      Writes a BSON Boolean element to the writer.
      void writeDateTime​(long value)
      Writes a BSON DateTime to the writer.
      void  name, long value)
      Writes a BSON DateTime element to the writer.
      void  name, BsonDbPointer value)
      Writes a BSON DBPointer element to the writer.
      void writeDBPointer​(BsonDbPointer value)
      Writes a BSON DBPointer to the writer.
      void  name, Decimal128 value)
      Writes a BSON Decimal128 element to the writer.
      void writeDecimal128​(Decimal128 value)
      Writes a BSON Decimal128 to the writer.
      void writeDouble​(double value)
      Writes a BSON Double to the writer.
      void  name, double value)
      Writes a BSON Double element to the writer.
      void writeEndArray()
      Writes the end of a BSON array to the writer.
      void writeEndDocument()
      Writes the end of a BSON document to the writer.
      void writeInt32​(int value)
      Writes a BSON Int32 to the writer.
      void  name, int value)
      Writes a BSON Int32 element to the writer.
      void writeInt64​(long value)
      Writes a BSON Int64 to the writer.
      void  name, long value)
      Writes a BSON Int64 element to the writer.
      void  code)
      Writes a BSON JavaScript to the writer.
      void  name,  code)
      Writes a BSON JavaScript element to the writer.
      void  code)
      Writes a BSON JavaScript to the writer (call WriteStartDocument to start writing the scope).
      void  name,  code)
      Writes a BSON JavaScript element to the writer (call WriteStartDocument to start writing the scope).
      void writeMaxKey()
      Writes a BSON MaxKey to the writer.
      void  name)
      Writes a BSON MaxKey element to the writer.
      void writeMinKey()
      Writes a BSON MinKey to the writer.
      void  name)
      Writes a BSON MinKey element to the writer.
      void  name)
      Writes the name of an element to the writer.
      void writeNull()
      Writes a BSON null to the writer.
      void  name)
      Writes a BSON null element to the writer.
      void  name, ObjectId objectId)
      Writes a BSON ObjectId element to the writer.
      void writeObjectId​(ObjectId objectId)
      Writes a BSON ObjectId to the writer.
      void  name, BsonRegularExpression regularExpression)
      Writes a BSON regular expression element to the writer.
      void writeRegularExpression​(BsonRegularExpression regularExpression)
      Writes a BSON regular expression to the writer.
      void writeStartArray()
      Writes the start of a BSON array to the writer.
      void  name)
      Writes the start of a BSON array element to the writer.
      void writeStartDocument()
      Writes the start of a BSON document to the writer.
      void  name)
      Writes the start of a BSON document element to the writer.
      void  value)
      Writes a BSON String to the writer.
      void  name,  value)
      Writes a BSON String element to the writer.
      void  value)
      Writes a BSON Symbol to the writer.
      void  name,  value)
      Writes a BSON Symbol element to the writer.
      void  name, BsonTimestamp value)
      Writes a BSON Timestamp element to the writer.
      void writeTimestamp​(BsonTimestamp value)
      Writes a BSON Timestamp to the writer.
      void writeUndefined()
      Writes a BSON undefined to the writer.
      void  name)
      Writes a BSON undefined element to the writer.
      • Methods inherited from class java.lang.

        , , , , , , , , , ,
    • Constructor Detail

      • AbstractBsonWriter

        protected AbstractBsonWriter​(BsonWriterSettings settings)
        Initializes a new instance of the BsonWriter class.
        Parameters:
        settings - The writer settings.
      • AbstractBsonWriter

        protected AbstractBsonWriter​(BsonWriterSettings settings,
                                     FieldNameValidator validator)
        Initializes a new instance of the BsonWriter class.
        Parameters:
        settings - The writer settings.
        validator - the field name validator
    • Method Detail

      • getName

        protected  getName()
        The name of the field being written.
        Returns:
        the name of the field
      • isClosed

        protected boolean isClosed()
        Returns whether this writer has been closed.
        Returns:
        true if the close() method has been called.
      • setState

        protected void setState​(AbstractBsonWriter.State state)
        Sets the current state of the writer. The current state determines what sort of actions are valid for this writer at this time.
        Parameters:
        state - the state to set this writer to.
      • getState

        protected AbstractBsonWriter.State getState()
        Gets the current state of this writer. The current state determines what sort of actions are valid for this writer at this time.
        Returns:
        the current state of the writer.
      • getContext

        protected AbstractBsonWriter.Context getContext()
        Get the context, which will indicate which state the writer is in, for example which part of a document it's currently writing.
        Returns:
        the current context.
      • setContext

        protected void setContext​(AbstractBsonWriter.Context context)
        Set the context, which will indicate which state the writer is in, for example which part of a document it's currently writing.
        Parameters:
        context - the new context for this writer
      • doWriteStartDocument

        protected abstract void doWriteStartDocument()
        Handles the logic to start writing a document
      • doWriteEndDocument

        protected abstract void doWriteEndDocument()
        Handles the logic of writing the end of a document
      • doWriteStartArray

        protected abstract void doWriteStartArray()
        Handles the logic to start writing an array
      • doWriteEndArray

        protected abstract void doWriteEndArray()
        Handles the logic of writing the end of an array
      • doWriteBinaryData

        protected abstract void doWriteBinaryData​(BsonBinary value)
        Handles the logic of writing a BsonBinary value
        Parameters:
        value - the BsonBinary value to write
      • doWriteBoolean

        protected abstract void doWriteBoolean​(boolean value)
        Handles the logic of writing a boolean value
        Parameters:
        value - the boolean value to write
      • doWriteDateTime

        protected abstract void doWriteDateTime​(long value)
        Handles the logic of writing a date time value
        Parameters:
        value - the long value to write
      • doWriteDBPointer

        protected abstract void doWriteDBPointer​(BsonDbPointer value)
        Handles the logic of writing a DbPointer value
        Parameters:
        value - the BsonDbPointer value to write
      • doWriteDouble

        protected abstract void doWriteDouble​(double value)
        Handles the logic of writing a Double value
        Parameters:
        value - the double value to write
      • doWriteInt32

        protected abstract void doWriteInt32​(int value)
        Handles the logic of writing an int32 value
        Parameters:
        value - the int value to write
      • doWriteInt64

        protected abstract void doWriteInt64​(long value)
        Handles the logic of writing an int64 value
        Parameters:
        value - the long value to write
      • doWriteDecimal128

        protected abstract void doWriteDecimal128​(Decimal128 value)
        Handles the logic of writing a Decimal128 value
        Parameters:
        value - the Decimal128 value to write
        Since:
        3.4
      • doWriteJavaScript

        protected abstract void doWriteJavaScript​( value)
        Handles the logic of writing a JavaScript function
        Parameters:
        value - the String value to write
      • doWriteJavaScriptWithScope

        protected abstract void doWriteJavaScriptWithScope​( value)
        Handles the logic of writing a scoped JavaScript function
        Parameters:
        value - the boolean value to write
      • doWriteMaxKey

        protected abstract void doWriteMaxKey()
        Handles the logic of writing a Max key
      • doWriteMinKey

        protected abstract void doWriteMinKey()
        Handles the logic of writing a Min key
      • doWriteNull

        protected abstract void doWriteNull()
        Handles the logic of writing a Null value
      • doWriteObjectId

        protected abstract void doWriteObjectId​(ObjectId value)
        Handles the logic of writing an ObjectId
        Parameters:
        value - the ObjectId value to write
      • doWriteRegularExpression

        protected abstract void doWriteRegularExpression​(BsonRegularExpression value)
        Handles the logic of writing a regular expression
        Parameters:
        value - the BsonRegularExpression value to write
      • doWriteString

        protected abstract void doWriteString​( value)
        Handles the logic of writing a String
        Parameters:
        value - the String value to write
      • doWriteSymbol

        protected abstract void doWriteSymbol​( value)
        Handles the logic of writing a Symbol
        Parameters:
        value - the boolean value to write
      • doWriteTimestamp

        protected abstract void doWriteTimestamp​(BsonTimestamp value)
        Handles the logic of writing a timestamp
        Parameters:
        value - the BsonTimestamp value to write
      • doWriteUndefined

        protected abstract void doWriteUndefined()
        Handles the logic of writing an Undefined value
      • writeStartDocument

        public void writeStartDocument​( name)
        Description copied from interface: BsonWriter
        Writes the start of a BSON document element to the writer.
        Specified by:
        writeStartDocument in interface BsonWriter
        Parameters:
        name - The name of the element.
      • writeStartDocument

        public void writeStartDocument()
        Description copied from interface: BsonWriter
        Writes the start of a BSON document to the writer.
        Specified by:
        writeStartDocument in interface BsonWriter
      • writeEndDocument

        public void writeEndDocument()
        Description copied from interface: BsonWriter
        Writes the end of a BSON document to the writer.
        Specified by:
        writeEndDocument in interface BsonWriter
      • writeStartArray

        public void writeStartArray​( name)
        Description copied from interface: BsonWriter
        Writes the start of a BSON array element to the writer.
        Specified by:
        writeStartArray in interface BsonWriter
        Parameters:
        name - The name of the element.
      • writeStartArray

        public void writeStartArray()
        Description copied from interface: BsonWriter
        Writes the start of a BSON array to the writer.
        Specified by:
        writeStartArray in interface BsonWriter
      • writeEndArray

        public void writeEndArray()
        Description copied from interface: BsonWriter
        Writes the end of a BSON array to the writer.
        Specified by:
        writeEndArray in interface BsonWriter
      • writeBinaryData

        public void writeBinaryData​( name,
                                    BsonBinary binary)
        Description copied from interface: BsonWriter
        Writes a BSON Binary data element to the writer.
        Specified by:
        writeBinaryData in interface BsonWriter
        Parameters:
        name - The name of the element.
        binary - The Binary data value.
      • writeBinaryData

        public void writeBinaryData​(BsonBinary binary)
        Description copied from interface: BsonWriter
        Writes a BSON Binary data element to the writer.
        Specified by:
        writeBinaryData in interface BsonWriter
        Parameters:
        binary - The Binary data.
      • writeBoolean

        public void writeBoolean​( name,
                                 boolean value)
        Description copied from interface: BsonWriter
        Writes a BSON Boolean element to the writer.
        Specified by:
        writeBoolean in interface BsonWriter
        Parameters:
        name - The name of the element.
        value - The Boolean value.
      • writeBoolean

        public void writeBoolean​(boolean value)
        Description copied from interface: BsonWriter
        Writes a BSON Boolean to the writer.
        Specified by:
        writeBoolean in interface BsonWriter
        Parameters:
        value - The Boolean value.
      • writeDateTime

        public void writeDateTime​( name,
                                  long value)
        Description copied from interface: BsonWriter
        Writes a BSON DateTime element to the writer.
        Specified by:
        writeDateTime in interface BsonWriter
        Parameters:
        name - The name of the element.
        value - The number of milliseconds since the Unix epoch.
      • writeDateTime

        public void writeDateTime​(long value)
        Description copied from interface: BsonWriter
        Writes a BSON DateTime to the writer.
        Specified by:
        writeDateTime in interface BsonWriter
        Parameters:
        value - The number of milliseconds since the Unix epoch.
      • writeDBPointer

        public void writeDBPointer​( name,
                                   BsonDbPointer value)
        Description copied from interface: BsonWriter
        Writes a BSON DBPointer element to the writer.
        Specified by:
        writeDBPointer in interface BsonWriter
        Parameters:
        name - The name of the element.
        value - The DBPointer to write
      • writeDBPointer

        public void writeDBPointer​(BsonDbPointer value)
        Description copied from interface: BsonWriter
        Writes a BSON DBPointer to the writer.
        Specified by:
        writeDBPointer in interface BsonWriter
        Parameters:
        value - The DBPointer to write
      • writeDouble

        public void writeDouble​( name,
                                double value)
        Description copied from interface: BsonWriter
        Writes a BSON Double element to the writer.
        Specified by:
        writeDouble in interface BsonWriter
        Parameters:
        name - The name of the element.
        value - The Double value.
      • writeDouble

        public void writeDouble​(double value)
        Description copied from interface: BsonWriter
        Writes a BSON Double to the writer.
        Specified by:
        writeDouble in interface BsonWriter
        Parameters:
        value - The Double value.
      • writeInt32

        public void writeInt32​( name,
                               int value)
        Description copied from interface: BsonWriter
        Writes a BSON Int32 element to the writer.
        Specified by:
        writeInt32 in interface BsonWriter
        Parameters:
        name - The name of the element.
        value - The Int32 value.
      • writeInt32

        public void writeInt32​(int value)
        Description copied from interface: BsonWriter
        Writes a BSON Int32 to the writer.
        Specified by:
        writeInt32 in interface BsonWriter
        Parameters:
        value - The Int32 value.
      • writeInt64

        public void writeInt64​( name,
                               long value)
        Description copied from interface: BsonWriter
        Writes a BSON Int64 element to the writer.
        Specified by:
        writeInt64 in interface BsonWriter
        Parameters:
        name - The name of the element.
        value - The Int64 value.
      • writeInt64

        public void writeInt64​(long value)
        Description copied from interface: BsonWriter
        Writes a BSON Int64 to the writer.
        Specified by:
        writeInt64 in interface BsonWriter
        Parameters:
        value - The Int64 value.
      • writeDecimal128

        public void writeDecimal128​(Decimal128 value)
        Description copied from interface: BsonWriter
        Writes a BSON Decimal128 to the writer.
        Specified by:
        writeDecimal128 in interface BsonWriter
        Parameters:
        value - The Decimal128 value.
      • writeDecimal128

        public void writeDecimal128​( name,
                                    Decimal128 value)
        Description copied from interface: BsonWriter
        Writes a BSON Decimal128 element to the writer.
        Specified by:
        writeDecimal128 in interface BsonWriter
        Parameters:
        name - The name of the element.
        value - The Decimal128 value.
      • writeJavaScript

        public void writeJavaScript​( name,
                                     code)
        Description copied from interface: BsonWriter
        Writes a BSON JavaScript element to the writer.
        Specified by:
        writeJavaScript in interface BsonWriter
        Parameters:
        name - The name of the element.
        code - The JavaScript code.
      • writeJavaScript

        public void writeJavaScript​( code)
        Description copied from interface: BsonWriter
        Writes a BSON JavaScript to the writer.
        Specified by:
        writeJavaScript in interface BsonWriter
        Parameters:
        code - The JavaScript code.
      • writeJavaScriptWithScope

        public void writeJavaScriptWithScope​( name,
                                              code)
        Description copied from interface: BsonWriter
        Writes a BSON JavaScript element to the writer (call WriteStartDocument to start writing the scope).
        Specified by:
        writeJavaScriptWithScope in interface BsonWriter
        Parameters:
        name - The name of the element.
        code - The JavaScript code.
      • writeJavaScriptWithScope

        public void writeJavaScriptWithScope​( code)
        Description copied from interface: BsonWriter
        Writes a BSON JavaScript to the writer (call WriteStartDocument to start writing the scope).
        Specified by:
        writeJavaScriptWithScope in interface BsonWriter
        Parameters:
        code - The JavaScript code.
      • writeMaxKey

        public void writeMaxKey​( name)
        Description copied from interface: BsonWriter
        Writes a BSON MaxKey element to the writer.
        Specified by:
        writeMaxKey in interface BsonWriter
        Parameters:
        name - The name of the element.
      • writeMaxKey

        public void writeMaxKey()
        Description copied from interface: BsonWriter
        Writes a BSON MaxKey to the writer.
        Specified by:
        writeMaxKey in interface BsonWriter
      • writeMinKey

        public void writeMinKey​( name)
        Description copied from interface: BsonWriter
        Writes a BSON MinKey element to the writer.
        Specified by:
        writeMinKey in interface BsonWriter
        Parameters:
        name - The name of the element.
      • writeMinKey

        public void writeMinKey()
        Description copied from interface: BsonWriter
        Writes a BSON MinKey to the writer.
        Specified by:
        writeMinKey in interface BsonWriter
      • writeName

        public void writeName​( name)
        Description copied from interface: BsonWriter
        Writes the name of an element to the writer.
        Specified by:
        writeName in interface BsonWriter
        Parameters:
        name - The name of the element.
      • doWriteName

        protected void doWriteName​( name)
        Handles the logic of writing the element name.
        Parameters:
        name - the name of the element
        Since:
        3.5
      • writeNull

        public void writeNull​( name)
        Description copied from interface: BsonWriter
        Writes a BSON null element to the writer.
        Specified by:
        writeNull in interface BsonWriter
        Parameters:
        name - The name of the element.
      • writeNull

        public void writeNull()
        Description copied from interface: BsonWriter
        Writes a BSON null to the writer.
        Specified by:
        writeNull in interface BsonWriter
      • writeObjectId

        public void writeObjectId​( name,
                                  ObjectId objectId)
        Description copied from interface: BsonWriter
        Writes a BSON ObjectId element to the writer.
        Specified by:
        writeObjectId in interface BsonWriter
        Parameters:
        name - The name of the element.
        objectId - The ObjectId value.
      • writeObjectId

        public void writeObjectId​(ObjectId objectId)
        Description copied from interface: BsonWriter
        Writes a BSON ObjectId to the writer.
        Specified by:
        writeObjectId in interface BsonWriter
        Parameters:
        objectId - The ObjectId value.
      • writeRegularExpression

        public void writeRegularExpression​( name,
                                           BsonRegularExpression regularExpression)
        Description copied from interface: BsonWriter
        Writes a BSON regular expression element to the writer.
        Specified by:
        writeRegularExpression in interface BsonWriter
        Parameters:
        name - The name of the element.
        regularExpression - The RegularExpression value.
      • writeRegularExpression

        public void writeRegularExpression​(BsonRegularExpression regularExpression)
        Description copied from interface: BsonWriter
        Writes a BSON regular expression to the writer.
        Specified by:
        writeRegularExpression in interface BsonWriter
        Parameters:
        regularExpression - the regular expression to write.
      • writeString

        public void writeString​( name,
                                 value)
        Description copied from interface: BsonWriter
        Writes a BSON String element to the writer.
        Specified by:
        writeString in interface BsonWriter
        Parameters:
        name - The name of the element.
        value - The String value.
      • writeString

        public void writeString​( value)
        Description copied from interface: BsonWriter
        Writes a BSON String to the writer.
        Specified by:
        writeString in interface BsonWriter
        Parameters:
        value - The String value.
      • writeSymbol

        public void writeSymbol​( name,
                                 value)
        Description copied from interface: BsonWriter
        Writes a BSON Symbol element to the writer.
        Specified by:
        writeSymbol in interface BsonWriter
        Parameters:
        name - The name of the element.
        value - The symbol.
      • writeSymbol

        public void writeSymbol​( value)
        Description copied from interface: BsonWriter
        Writes a BSON Symbol to the writer.
        Specified by:
        writeSymbol in interface BsonWriter
        Parameters:
        value - The symbol.
      • writeTimestamp

        public void writeTimestamp​( name,
                                   BsonTimestamp value)
        Description copied from interface: BsonWriter
        Writes a BSON Timestamp element to the writer.
        Specified by:
        writeTimestamp in interface BsonWriter
        Parameters:
        name - The name of the element.
        value - The combined timestamp/increment value.
      • writeTimestamp

        public void writeTimestamp​(BsonTimestamp value)
        Description copied from interface: BsonWriter
        Writes a BSON Timestamp to the writer.
        Specified by:
        writeTimestamp in interface BsonWriter
        Parameters:
        value - The combined timestamp/increment value.
      • writeUndefined

        public void writeUndefined​( name)
        Description copied from interface: BsonWriter
        Writes a BSON undefined element to the writer.
        Specified by:
        writeUndefined in interface BsonWriter
        Parameters:
        name - The name of the element.
      • writeUndefined

        public void writeUndefined()
        Description copied from interface: BsonWriter
        Writes a BSON undefined to the writer.
        Specified by:
        writeUndefined in interface BsonWriter
      • checkState

        protected boolean checkState​(AbstractBsonWriter.State[] validStates)
        Checks if this writer's current state is in the list of given states.
        Parameters:
        validStates - an array of States to compare this writer's state to.
        Returns:
        true if this writer's state is in the given list.
      • checkPreconditions

        protected void checkPreconditions​( methodName,
                                          AbstractBsonWriter.State... validStates)
        Checks the writer is in the correct state. If the writer's current state is in the list of given states, this method will complete without exception. Throws an if the writer is closed. Throws BsonInvalidOperationException if the method is trying to do something that is not permitted in the current state.
        Parameters:
        methodName - the name of the method being performed that checks are being performed for
        validStates - the list of valid states for this operation
        See Also:
        throwInvalidState(String, org.bson.AbstractBsonWriter.State...)
      • throwInvalidContextType

        protected void throwInvalidContextType​( methodName,
                                               BsonContextType actualContextType,
                                               BsonContextType... validContextTypes)
        Throws an InvalidOperationException when the method called is not valid for the current ContextType.
        Parameters:
        methodName - The name of the method.
        actualContextType - The actual ContextType.
        validContextTypes - The valid ContextTypes.
        Throws:
        BsonInvalidOperationException - when the method called is not valid for the current ContextType.
      • close

        public void close()
        Specified by:
         in interface 
        Specified by:
         in interface 
      • pipe

        public void pipe​(BsonReader reader)
        Description copied from interface: BsonWriter
        Reads a single document from a BsonReader and writes it to this.
        Specified by:
        pipe in interface BsonWriter
        Parameters:
        reader - The source.
      • pipe

        public void pipe​(BsonReader reader,
                         <BsonElement> extraElements)
        Reads a single document from the given BsonReader and writes it to this, appending the given extra elements to the document.
        Parameters:
        reader - the source of the document
        extraElements - the extra elements to append to the document
        Since:
        3.6
      • pipeExtraElements

        protected void pipeExtraElements​(<BsonElement> extraElements)
        Pipe a list of extra element to this writer
        Parameters:
        extraElements - the extra elements
      • abortPipe

        protected boolean abortPipe()
        Return true if the current execution of the pipe method should be aborted.
        Returns:
        true if the current execution of the pipe method should be aborted.
        Since:
        3.7