# Blob


```
class Blob : Comparable
```

<br />

*** ** * ** ***

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 |
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html` | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/Blob#compareTo(com.google.firebase.firestore.Blob)(other: https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/Blob)` |
| `java-static https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/Blob` | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/Blob#createBsonBinary(byte[])(bytes: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-byte-array/index.html)` Creates a BSON Binary type Blob with subtype 0. |
| `java-static https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/Blob` | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/Blob#createBsonBinary(int,byte[])(subtype: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html, bytes: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-byte-array/index.html)` Creates a BSON Binary type Blob with the specified subtype. |
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html` | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/Blob#equals(java.lang.Object)(other: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html?)` |
| `java-static https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/Blob` | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/Blob#fromBytes(byte[])(bytes: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-byte-array/index.html)` Creates a new `Blob` instance from the provided bytes. |
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html` | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/Blob#getSubType()()` Returns the subtype of this BSON binary data. |
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html` | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/Blob#hashCode()()` |
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-byte-array/index.html<https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-byte/index.html>` | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/Blob#toBytes()()` |
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html` | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/Blob#toString()()` |

## 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: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-byte-array/index.html` | The bytes to use for this BSON binary `Blob` instance. |

| Returns |
|---|---|
| `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/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: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html` | The BSON binary subtype. Must be in the \[0, 255\] range. |
| `bytes: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-byte-array/index.html` | The bytes to use for this BSON binary `Blob` instance. |

| Returns |
|---|---|
| `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/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: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-byte-array/index.html` | The bytes to use for this `Blob` instance. |

| Returns |
|---|---|
| `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/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 |
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html` | The BSON binary subtype. |

### hashCode

```
fun hashCode(): Int
```

### toBytes

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

| Returns |
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-byte-array/index.html<https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-byte/index.html>` | The bytes of this blob as a new byte\[\] array. |

### toString

```
fun toString(): String
```