Package org.bson

Interface BsonReader

    • Method Summary

      All Methods Instance Methods Abstract Methods Deprecated Methods 
      Modifier and Type Method Description
      void close()  
      BsonType getCurrentBsonType()  
      getCurrentName()
      Gets the most recently read name.
      BsonReaderMark getMark()
      Gets a mark representing the current state of the reader.
      void mark()
      Deprecated.
      Use getMark() instead
      int peekBinarySize()
      Peeks the size of the binary data that the reader is positioned at.
      byte peekBinarySubType()
      Peeks the subtype of the binary data that the reader is positioned at.
      BsonBinary readBinaryData()
      Reads BSON Binary data from the reader.
      BsonBinary  name)
      Reads a BSON Binary data element from the reader.
      boolean readBoolean()
      Reads a BSON Boolean from the reader.
      boolean  name)
      Reads a BSON Boolean element from the reader.
      BsonType readBsonType()
      Reads a BSONType from the reader.
      long readDateTime()
      Reads a BSON DateTime from the reader.
      long  name)
      Reads a BSON DateTime element from the reader.
      BsonDbPointer readDBPointer()
      Reads a BSON DBPointer from the reader.
      BsonDbPointer  name)
      Reads a BSON DBPointer element from the reader.
      Decimal128 readDecimal128()
      Reads a BSON Decimal128 from the reader.
      Decimal128  name)
      Reads a BSON Decimal128 element from the reader.
      double readDouble()
      Reads a BSON Double from the reader.
      double  name)
      Reads a BSON Double element from the reader.
      void readEndArray()
      Reads the end of a BSON array from the reader.
      void readEndDocument()
      Reads the end of a BSON document from the reader.
      int readInt32()
      Reads a BSON Int32 from the reader.
      int  name)
      Reads a BSON Int32 element from the reader.
      long readInt64()
      Reads a BSON Int64 from the reader.
      long  name)
      Reads a BSON Int64 element from the reader.
      readJavaScript()
      Reads a BSON JavaScript from the reader.
       name)
      Reads a BSON JavaScript element from the reader.
      readJavaScriptWithScope()
      Reads a BSON JavaScript with scope from the reader (call readStartDocument next to read the scope).
       name)
      Reads a BSON JavaScript with scope element from the reader (call readStartDocument next to read the scope).
      void readMaxKey()
      Reads a BSON MaxKey from the reader.
      void  name)
      Reads a BSON MaxKey element from the reader.
      void readMinKey()
      Reads a BSON MinKey from the reader.
      void  name)
      Reads a BSON MinKey element from the reader.
      readName()
      Reads the name of an element from the reader.
      void  name)
      Reads the name of an element from the reader.
      void readNull()
      Reads a BSON null from the reader.
      void  name)
      Reads a BSON null element from the reader.
      ObjectId readObjectId()
      Reads a BSON ObjectId from the reader.
      ObjectId  name)
      Reads a BSON ObjectId element from the reader.
      BsonRegularExpression readRegularExpression()
      Reads a BSON regular expression from the reader.
      BsonRegularExpression  name)
      Reads a BSON regular expression element from the reader.
      void readStartArray()
      Reads the start of a BSON array.
      void readStartDocument()
      Reads the start of a BSON document.
      readString()
      Reads a BSON String from the reader.
       name)
      Reads a BSON string element from the reader.
      readSymbol()
      Reads a BSON symbol from the reader.
       name)
      Reads a BSON symbol element from the reader.
      BsonTimestamp readTimestamp()
      Reads a BSON timestamp from the reader.
      BsonTimestamp  name)
      Reads a BSON timestamp element from the reader.
      void readUndefined()
      Reads a BSON undefined from the reader.
      void  name)
      Reads a BSON undefined element from the reader.
      void reset()
      Deprecated.
      Prefer getMark()
      void skipName()
      Skips the name (reader must be positioned on a name).
      void skipValue()
      Skips the value (reader must be positioned on a value).
    • Method Detail

      • getCurrentBsonType

        BsonType getCurrentBsonType()
        Returns:
        The current BsonType.
      • getCurrentName

         getCurrentName()
        Gets the most recently read name.
        Returns:
        the most recently read name
      • readBinaryData

        BsonBinary readBinaryData()
        Reads BSON Binary data from the reader.
        Returns:
        A Binary.
      • peekBinarySubType

        byte peekBinarySubType()
        Peeks the subtype of the binary data that the reader is positioned at. This operation is not permitted if the mark is already set.
        Returns:
        the subtype
        See Also:
        mark()
      • peekBinarySize

        int peekBinarySize()
        Peeks the size of the binary data that the reader is positioned at. This operation is not permitted if the mark is already set.
        Returns:
        the size of the binary data
        Since:
        3.4
        See Also:
        mark()
      • readBinaryData

         name)
        Reads a BSON Binary data element from the reader.
        Parameters:
        name - The name of the element.
        Returns:
        A Binary.
      • readBoolean

        boolean readBoolean()
        Reads a BSON Boolean from the reader.
        Returns:
        A Boolean.
      • readBoolean

        boolean readBoolean​( name)
        Reads a BSON Boolean element from the reader.
        Parameters:
        name - The name of the element.
        Returns:
        A Boolean.
      • readBsonType

        BsonType readBsonType()
        Reads a BSONType from the reader.
        Returns:
        A BSONType.
      • readDateTime

        long readDateTime()
        Reads a BSON DateTime from the reader.
        Returns:
        The number of milliseconds since the Unix epoch.
      • readDateTime

        long readDateTime​( name)
        Reads a BSON DateTime element from the reader.
        Parameters:
        name - The name of the element.
        Returns:
        The number of milliseconds since the Unix epoch.
      • readDouble

        double readDouble()
        Reads a BSON Double from the reader.
        Returns:
        A Double.
      • readDouble

        double readDouble​( name)
        Reads a BSON Double element from the reader.
        Parameters:
        name - The name of the element.
        Returns:
        A Double.
      • readEndArray

        void readEndArray()
        Reads the end of a BSON array from the reader.
      • readEndDocument

        void readEndDocument()
        Reads the end of a BSON document from the reader.
      • readInt32

        int readInt32()
        Reads a BSON Int32 from the reader.
        Returns:
        An Int32.
      • readInt32

        int readInt32​( name)
        Reads a BSON Int32 element from the reader.
        Parameters:
        name - The name of the element.
        Returns:
        An Int32.
      • readInt64

        long readInt64()
        Reads a BSON Int64 from the reader.
        Returns:
        An Int64.
      • readInt64

        long readInt64​( name)
        Reads a BSON Int64 element from the reader.
        Parameters:
        name - The name of the element.
        Returns:
        An Int64.
      • readDecimal128

        Decimal128 readDecimal128()
        Reads a BSON Decimal128 from the reader.
        Returns:
        A Decimal128
        Since:
        3.4
      • readDecimal128

         name)
        Reads a BSON Decimal128 element from the reader.
        Parameters:
        name - The name of the element.
        Returns:
        A Decimal128
        Since:
        3.4
      • readJavaScript

         readJavaScript()
        Reads a BSON JavaScript from the reader.
        Returns:
        A string.
      • readJavaScript

         readJavaScript​( name)
        Reads a BSON JavaScript element from the reader.
        Parameters:
        name - The name of the element.
        Returns:
        A string.
      • readJavaScriptWithScope

         readJavaScriptWithScope()
        Reads a BSON JavaScript with scope from the reader (call readStartDocument next to read the scope).
        Returns:
        A string.
      • readJavaScriptWithScope

         readJavaScriptWithScope​( name)
        Reads a BSON JavaScript with scope element from the reader (call readStartDocument next to read the scope).
        Parameters:
        name - The name of the element.
        Returns:
        A string.
      • readMaxKey

        void readMaxKey()
        Reads a BSON MaxKey from the reader.
      • readMaxKey

        void readMaxKey​( name)
        Reads a BSON MaxKey element from the reader.
        Parameters:
        name - The name of the element.
      • readMinKey

        void readMinKey()
        Reads a BSON MinKey from the reader.
      • readMinKey

        void readMinKey​( name)
        Reads a BSON MinKey element from the reader.
        Parameters:
        name - The name of the element.
      • readName

         readName()
        Reads the name of an element from the reader.
        Returns:
        The name of the element.
      • readName

        void readName​( name)
        Reads the name of an element from the reader.
        Parameters:
        name - The name of the element.
      • readNull

        void readNull()
        Reads a BSON null from the reader.
      • readNull

        void readNull​( name)
        Reads a BSON null element from the reader.
        Parameters:
        name - The name of the element.
      • readObjectId

        ObjectId readObjectId()
        Reads a BSON ObjectId from the reader.
        Returns:
        the ObjectId value
      • readObjectId

         name)
        Reads a BSON ObjectId element from the reader.
        Parameters:
        name - The name of the element.
        Returns:
        ObjectId.
      • readRegularExpression

        BsonRegularExpression readRegularExpression()
        Reads a BSON regular expression from the reader.
        Returns:
        A regular expression.
      • readRegularExpression

         name)
        Reads a BSON regular expression element from the reader.
        Parameters:
        name - The name of the element.
        Returns:
        A regular expression.
      • readDBPointer

        BsonDbPointer readDBPointer()
        Reads a BSON DBPointer from the reader.
        Returns:
        A DBPointer.
      • readDBPointer

         name)
        Reads a BSON DBPointer element from the reader.
        Parameters:
        name - The name of the element.
        Returns:
        A DBPointer.
      • readStartArray

        void readStartArray()
        Reads the start of a BSON array.
      • readStartDocument

        void readStartDocument()
        Reads the start of a BSON document.
      • readString

         readString()
        Reads a BSON String from the reader.
        Returns:
        A String.
      • readString

         readString​( name)
        Reads a BSON string element from the reader.
        Parameters:
        name - The name of the element.
        Returns:
        A String.
      • readSymbol

         readSymbol()
        Reads a BSON symbol from the reader.
        Returns:
        A string.
      • readSymbol

         readSymbol​( name)
        Reads a BSON symbol element from the reader.
        Parameters:
        name - The name of the element.
        Returns:
        A string.
      • readTimestamp

        BsonTimestamp readTimestamp()
        Reads a BSON timestamp from the reader.
        Returns:
        The combined timestamp/increment.
      • readTimestamp

         name)
        Reads a BSON timestamp element from the reader.
        Parameters:
        name - The name of the element.
        Returns:
        The combined timestamp/increment.
      • readUndefined

        void readUndefined()
        Reads a BSON undefined from the reader.
      • readUndefined

        void readUndefined​( name)
        Reads a BSON undefined element from the reader.
        Parameters:
        name - The name of the element.
      • skipName

        void skipName()
        Skips the name (reader must be positioned on a name).
      • skipValue

        void skipValue()
        Skips the value (reader must be positioned on a value).
      • mark

        void mark()
        Deprecated.
        Use getMark() instead
        Creates a bookmark in the BsonReader's input The previous mark must be cleared before creating a new one
      • getMark

        BsonReaderMark getMark()
        Gets a mark representing the current state of the reader.
        Returns:
        the mark
        Since:
        3.5
      • reset

        void reset()
        Deprecated.
        Prefer getMark()
        Go back to the state at the last mark and removes the mark
        Throws:
        BSONException - if no mark has been set
      • close

        void close()
        Specified by:
         in interface 
        Specified by:
         in interface