Package org.bson

Class RawBsonDocument

All Implemented Interfaces:
Serializable, Cloneable, Map<String,BsonValue>, Bson

public final class RawBsonDocument extends BsonDocument
An immutable BSON document that is represented using only the raw bytes.
Since:
3.0
See Also:
  • Constructor Details

    • RawBsonDocument

      public RawBsonDocument(byte[] bytes)
      Constructs a new instance with the given byte array. Note that it does not make a copy of the array, so do not modify it after passing it to this constructor.
      Parameters:
      bytes - the bytes representing a BSON document. Note that the byte array is NOT copied, so care must be taken not to modify it after passing it to this construction, unless of course that is your intention.
    • RawBsonDocument

      public RawBsonDocument(byte[] bytes, int offset, int length)
      Constructs a new instance with the given byte array, offset, and length. Note that it does not make a copy of the array, so do not modify it after passing it to this constructor.
      Parameters:
      bytes - the bytes representing a BSON document. Note that the byte array is NOT copied, so care must be taken not to modify it after passing it to this construction, unless of course that is your intention.
      offset - the offset into the byte array
      length - the length of the subarray to use
      Since:
      3.3
    • RawBsonDocument

      public RawBsonDocument(T document, Codec<T> codec)
      Construct a new instance from the given document and codec for the document type.
      Type Parameters:
      T - the BSON type that the codec encodes/decodes
      Parameters:
      document - the document to transform
      codec - the codec to facilitate the transformation
  • Method Details