Package org.bson

Class BasicBSONEncoder

  • All Implemented Interfaces:
    BSONEncoder
    Direct Known Subclasses:
    DefaultDBEncoder

    public class BasicBSONEncoder
    extends java.lang.Object
    implements BSONEncoder
    This is meant to be pooled or cached. There is some per instance memory for string conversion, etc...
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void done()
      Free the resources.
      byte[] encode​(BSONObject document)
      Encode a document into byte array.
      int putObject​(BSONObject document)
      Encodes a BSONObject.
      void set​(OutputBuffer buffer)
      Sets the buffer to wrich the result of encoding will be written.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • BasicBSONEncoder

        public BasicBSONEncoder()
    • Method Detail

      • done

        public void done()
        Description copied from interface: BSONEncoder
        Free the resources.
        Specified by:
        done in interface BSONEncoder
      • set

        public void set​(OutputBuffer buffer)
        Description copied from interface: BSONEncoder
        Sets the buffer to wrich the result of encoding will be written.
        Specified by:
        set in interface BSONEncoder
        Parameters:
        buffer - the buffer to be used to write a byte sequences to
      • putObject

        public int putObject​(BSONObject document)
        Encodes a BSONObject. This is for the higher level api calls.
        Specified by:
        putObject in interface BSONEncoder
        Parameters:
        document - the document to encode
        Returns:
        the number of characters in the encoding