Package org.bson

Class BasicBSONDecoder

  • All Implemented Interfaces:
    BSONDecoder

    public class BasicBSONDecoder
    extends Object
    implements BSONDecoder
    Basic implementation of BSONDecoder interface that creates BasicBSONObject instances
    • Constructor Detail

      • BasicBSONDecoder

        public BasicBSONDecoder()
    • Method Detail

      • readObject

        public BSONObject readObject​(byte[] bytes)
        Description copied from interface: BSONDecoder
        Read a single BSON object from the given bytes.
        Specified by:
        readObject in interface BSONDecoder
        Parameters:
        bytes - the bytes in BSON format
        Returns:
        the BSON object for the given bytes
      • readObject

        public BSONObject readObject​(InputStream in)
                              throws IOException
        Description copied from interface: BSONDecoder
        Read a single BSON object from the given input stream.
        Specified by:
        readObject in interface BSONDecoder
        Parameters:
        in - the input stream in BSON format
        Returns:
        the BSON object for the given bytes
        Throws:
        IOException - if there's a problem reading the object from the InputStream
      • decode

        public int decode​(byte[] bytes,
                          BSONCallback callback)
        Description copied from interface: BSONDecoder
        Decode a single BSON object into the given callback from the given byte array.
        Specified by:
        decode in interface BSONDecoder
        Parameters:
        bytes - the bytes in BSON format
        callback - the callback
        Returns:
        the number of bytes in the BSON object
      • decode

        public int decode​(InputStream in,
                          BSONCallback callback)
                   throws IOException
        Description copied from interface: BSONDecoder
        Decode a single BSON object into the given callback from the given input stream.
        Specified by:
        decode in interface BSONDecoder
        Parameters:
        in - the input stream in BSON format
        callback - the callback
        Returns:
        the number of bytes read from the input stream
        Throws:
        IOException - if there's a problem reading from the InputStream