Package org.bson.types
Class Binary
java.lang.Object
org.bson.types.Binary
- All Implemented Interfaces:
Serializable
Generic binary holder.
- See Also:
-
Constructor Summary
ConstructorDescriptionBinary
(byte[] data) Creates a Binary object with the default binary type of 0Binary
(byte type, byte[] data) Creates a Binary objectBinary
(BsonBinarySubType type, byte[] data) Creates a Binary with the specified type and data. -
Method Summary
-
Constructor Details
-
Binary
public Binary(byte[] data) Creates a Binary object with the default binary type of 0- Parameters:
data
- raw data
-
Binary
Creates a Binary with the specified type and data.- Parameters:
type
- the binary typedata
- the binary data
-
Binary
public Binary(byte type, byte[] data) Creates a Binary object- Parameters:
type
- type of the field as encoded in BSONdata
- raw data
-
-
Method Details
-
getType
public byte getType()Get the binary sub type as a byte.- Returns:
- the binary sub type as a byte.
-
getData
public byte[] getData()Get a copy of the binary value.- Returns:
- a copy of the binary value.
-
length
public int length()Get the length of the data.- Returns:
- the length of the binary array.
-
equals
-
hashCode
public int hashCode()
-