Package org.bson
Class PackedBitBinaryVector
java.lang.Object
org.bson.BinaryVector
org.bson.PackedBitBinaryVector
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
-
Nested Class Summary
Nested classes/interfaces inherited from class org.bson.BinaryVector
BinaryVector.DataType
-
Method Summary
Modifier and TypeMethodDescriptionboolean
byte[]
getData()
Retrieve the underlying byte array representing thisPackedBitBinaryVector
vector, where each bit represents an element of the vector (either 0 or 1).byte
Returns the padding value for this vector.int
hashCode()
toString()
Methods inherited from class org.bson.BinaryVector
asFloat32Vector, asInt8Vector, asPackedBitVector, floatVector, getDataType, int8Vector, packedBitVector
-
Method Details
-
getData
public byte[] getData()Retrieve the underlying byte array representing thisPackedBitBinaryVector
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
-
hashCode
public int hashCode() -
toString
-