Package org.bson
Class BsonBinary
- java.lang.Object
-
- org.bson.BsonValue
-
- org.bson.BsonBinary
-
public class BsonBinary extends BsonValue
A representation of the BSON Binary type. Note that for performance reasons instances of this class are not immutable, so care should be taken to only modify the underlying byte array if you know what you're doing, or else make a defensive copy.- Since:
- 3.0
-
-
Constructor Summary
Constructors Constructor Description BsonBinary(byte[] data)
Construct a new instance with the given data and the default sub-typeBsonBinary(byte type, byte[] data)
Construct a new instance with the given data and binary sub type.BsonBinary(BsonBinarySubType type, byte[] data)
Construct a new instance with the given data and binary sub type.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object o)
BsonType
getBsonType()
Gets the BSON type of this value.byte[]
getData()
Gets the data of this Binary.byte
getType()
Gets the type of this Binary.int
hashCode()
java.lang.String
toString()
-
Methods inherited from class org.bson.BsonValue
asArray, asBinary, asBoolean, asDateTime, asDBPointer, asDecimal128, asDocument, asDouble, asInt32, asInt64, asJavaScript, asJavaScriptWithScope, asNumber, asObjectId, asRegularExpression, asString, asSymbol, asTimestamp, isArray, isBinary, isBoolean, isDateTime, isDBPointer, isDecimal128, isDocument, isDouble, isInt32, isInt64, isJavaScript, isJavaScriptWithScope, isNull, isNumber, isObjectId, isRegularExpression, isString, isSymbol, isTimestamp
-
-
-
-
Constructor Detail
-
BsonBinary
public BsonBinary(byte[] data)
Construct a new instance with the given data and the default sub-type- Parameters:
data
- the data- See Also:
BsonBinarySubType.BINARY
-
BsonBinary
public BsonBinary(BsonBinarySubType type, byte[] data)
Construct a new instance with the given data and binary sub type.- Parameters:
data
- the datatype
- the binary sub type- See Also:
BsonBinarySubType.BINARY
-
BsonBinary
public BsonBinary(byte type, byte[] data)
Construct a new instance with the given data and binary sub type.- Parameters:
data
- the datatype
- the binary sub type- See Also:
BsonBinarySubType.BINARY
-
-
Method Detail
-
getBsonType
public BsonType getBsonType()
Description copied from class:BsonValue
Gets the BSON type of this value.- Specified by:
getBsonType
in classBsonValue
- Returns:
- the BSON type, which may not be null (but may be BSONType.NULL)
-
getType
public byte getType()
Gets the type of this Binary.- Returns:
- the type
-
getData
public byte[] getData()
Gets the data of this Binary.- Returns:
- the data
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-