Package org.bson

Class PackedBitBinaryVector

java.lang.Object
org.bson.BinaryVector
org.bson.PackedBitBinaryVector

@Beta(SERVER) public final class PackedBitBinaryVector extends BinaryVector
Represents a packed bit vector, where each element of the vector is represented by a single bit (0 or 1).

The PackedBitBinaryVector is used to store data efficiently using the BSON Binary Subtype 9 format.

Since:
5.3
See Also:
Since server release
6.0
  • Method Details

    • getData

      public byte[] getData()
      Retrieve the underlying byte array representing this PackedBitBinaryVector vector, where each bit represents an element of the vector (either 0 or 1).

      Note that the padding value should be considered when interpreting the final byte of the array, as it indicates how many least-significant bits are to be ignored.

      Returns:
      the underlying byte array representing this PackedBitBinaryVector vector.
      See Also:
    • getPadding

      public byte getPadding()
      Returns the padding value for this vector.

      Padding refers to the number of least-significant bits in the final byte that are ignored when retrieving the vector array. For instance, if the padding value is 3, this means that the last byte contains 3 least-significant unused bits, which should be disregarded during operations.

      NOTE: The underlying byte array is not copied; changes to the returned array will be reflected in this instance.

      Returns:
      the padding value (between 0 and 7).
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object