BsonBinary

class BsonBinary(type: Byte, data: ByteArray) : 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: BsonBinary.clone.

Constructors

Link copied to clipboard
fun BsonBinary(data: ByteArray)

Construct a new instance with the given data and the default subtype BsonBinarySubType.BINARY.

Link copied to clipboard
fun BsonBinary(type: BsonBinarySubType, data: ByteArray)

Construct a new instance with the given data and byte value of the subtype

Link copied to clipboard
fun BsonBinary(type: Byte, data: ByteArray)

constructs a new instance with the given subtype and data

Functions

Link copied to clipboard
fun asArray(): BsonArray

Gets this value as a BsonArray if it is one, otherwise throws exception

Link copied to clipboard
fun asBinary(): BsonBinary

Gets this value as a BsonBinary if it is one, otherwise throws exception

Link copied to clipboard
fun asBoolean(): BsonBoolean

Gets this value as a BsonBoolean if it is one, otherwise throws exception

Link copied to clipboard
fun asBsonMaxKey(): BsonMaxKey

Gets this value as a BsonMaxKey if it is one, otherwise throws exception

Link copied to clipboard
fun asBsonMinKey(): BsonMinKey

Gets this value as a BsonMinKey if it is one, otherwise throws exception

Link copied to clipboard
fun asBsonNull(): BsonNull

Gets this value as a BsonNull if it is one, otherwise throws exception

Link copied to clipboard
fun asBsonUndefined(): BsonUndefined

Gets this value as a BsonUndefined if it is one, otherwise throws exception

Link copied to clipboard
fun asDateTime(): BsonDateTime

Gets this value as a BsonDateTime if it is one, otherwise throws exception

Link copied to clipboard
fun asDBPointer(): BsonDBPointer

Gets this value as a BsonDBPointer if it is one, otherwise throws exception

Link copied to clipboard
fun asDecimal128(): BsonDecimal128

Gets this value as a BsonDecimal128 if it is one, otherwise throws exception

Link copied to clipboard
fun asDocument(): BsonDocument

Gets this value as a BsonDocument if it is one, otherwise throws exception

Link copied to clipboard
fun asDouble(): BsonDouble

Gets this value as a BsonDouble if it is one, otherwise throws exception

Link copied to clipboard
fun asInt32(): BsonInt32

Gets this value as a BsonInt32 if it is one, otherwise throws exception

Link copied to clipboard
fun asInt64(): BsonInt64

Gets this value as a BsonInt64 if it is one, otherwise throws exception

Link copied to clipboard
fun asJavaScript(): BsonJavaScript

Gets this value as a BsonJavaScript if it is one, otherwise throws exception

Link copied to clipboard
fun asJavaScriptWithScope(): BsonJavaScriptWithScope

Gets this value as a BsonJavaScriptWithScope if it is one, otherwise throws exception

Link copied to clipboard
fun asNumber(): BsonNumber

Gets this value as a BsonNumber if it is one, otherwise throws exception

Link copied to clipboard
fun asObjectId(): BsonObjectId

Gets this value as an BsonObjectId if it is one, otherwise throws exception

Link copied to clipboard
fun asRegularExpression(): BsonRegularExpression

Gets this value as a BsonRegularExpression if it is one, otherwise throws exception

Link copied to clipboard
fun asString(): BsonString

Gets this value as a BsonString if it is one, otherwise throws exception

Link copied to clipboard
fun asSymbol(): BsonSymbol

Gets this value as a BsonSymbol if it is one, otherwise throws exception

Link copied to clipboard
fun asTimestamp(): BsonTimestamp

Gets this value as a BsonTimestamp if it is one, otherwise throws exception

Link copied to clipboard
fun clone(): BsonBinary

Clones this BsonBinary

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
fun isArray(): Boolean
Link copied to clipboard
fun isBinary(): Boolean
Link copied to clipboard
fun isBoolean(): Boolean
Link copied to clipboard
fun isDateTime(): Boolean
Link copied to clipboard
fun isDBPointer(): Boolean
Link copied to clipboard
fun isDecimal128(): Boolean
Link copied to clipboard
fun isDocument(): Boolean
Link copied to clipboard
fun isDouble(): Boolean
Link copied to clipboard
fun isInt32(): Boolean
Link copied to clipboard
fun isInt64(): Boolean
Link copied to clipboard
fun isJavaScript(): Boolean
Link copied to clipboard
fun isJavaScriptWithScope(): Boolean
Link copied to clipboard
fun isMaxKey(): Boolean
Link copied to clipboard
fun isMinKey(): Boolean
Link copied to clipboard
fun isNull(): Boolean
Link copied to clipboard
fun isNumber(): Boolean
Link copied to clipboard
fun isObjectId(): Boolean
Link copied to clipboard
fun isRegularExpression(): Boolean
Link copied to clipboard
fun isString(): Boolean
Link copied to clipboard
fun isSymbol(): Boolean
Link copied to clipboard
fun isTimestamp(): Boolean
Link copied to clipboard
fun isUndefined(): Boolean
Link copied to clipboard
fun toJson(): String

Return an extended json representation of this BsonValue

Link copied to clipboard
open override fun toString(): String

Properties

Link copied to clipboard
open override val bsonType: BsonType

Gets the BSON type of this value.

Link copied to clipboard
val data: ByteArray
Link copied to clipboard
val type: Byte

the BsonBinarySubType byte value