Blob

class Blob : Comparable


Immutable class representing an array of bytes in Cloud Firestore.

Can represent either standard binary data or BSON binary data with a specific subtype.

Summary

Public functions

Int
compareTo(other: Blob)
java-static Blob

Creates a BSON Binary type Blob with subtype 0.

java-static Blob
createBsonBinary(subtype: Int, bytes: ByteArray)

Creates a BSON Binary type Blob with the specified subtype.

Boolean
equals(other: Any?)
java-static Blob

Creates a new Blob instance from the provided bytes.

Int

Returns the subtype of this BSON binary data.

Int
ByteArray<Byte>
String

Public functions

compareTo

fun compareTo(other: Blob): Int

createBsonBinary

java-static fun createBsonBinary(bytes: ByteArray): Blob

Creates a BSON Binary type Blob with subtype 0. Will make a copy of the bytes passed in.

Parameters
bytes: ByteArray

The bytes to use for this BSON binary Blob instance.

Returns
Blob

The new BSON binary Blob instance

createBsonBinary

java-static fun createBsonBinary(subtype: Int, bytes: ByteArray): Blob

Creates a BSON Binary type Blob with the specified subtype. Will make a copy of the bytes passed in.

Parameters
subtype: Int

The BSON binary subtype. Must be in the [0, 255] range.

bytes: ByteArray

The bytes to use for this BSON binary Blob instance.

Returns
Blob

The new BSON binary Blob instance

equals

fun equals(other: Any?): Boolean

fromBytes

java-static fun fromBytes(bytes: ByteArray): Blob

Creates a new Blob instance from the provided bytes. Will make a copy of the bytes passed in.

By default, the subtype of a standard Blob is 0.

Parameters
bytes: ByteArray

The bytes to use for this Blob instance.

Returns
Blob

The new Blob instance

getSubType

fun getSubType(): Int

Returns the subtype of this BSON binary data. Returns 0 for standard non-BSON Blobs.

Returns
Int

The BSON binary subtype.

hashCode

fun hashCode(): Int

toBytes

fun toBytes(): ByteArray<Byte>
Returns
ByteArray<Byte>

The bytes of this blob as a new byte[] array.

toString

fun toString(): String