public final class Blob implements SerializableImmutable class representing an array of bytes in Firestore.
Implements
SerializableStatic Methods
createBsonBinary(byte[] bytes)
public static Blob createBsonBinary(byte[] bytes)Creates a new Blob instance representing a BSON binary data type. Sets subtype to 0 and representation to BSON.
| Parameter | |
|---|---|
| Name | Description |
bytes |
byte[]The bytes to use for this Blob instance. |
| Returns | |
|---|---|
| Type | Description |
Blob |
The new Blob instance |
createBsonBinary(ByteString data)
public static Blob createBsonBinary(ByteString data)Creates a new Blob instance representing a BSON binary data type. Sets subtype to 0 and representation to BSON.
| Parameter | |
|---|---|
| Name | Description |
data |
ByteStringThe ByteString to use for this Blob instance. |
| Returns | |
|---|---|
| Type | Description |
Blob |
The new Blob instance |
createBsonBinary(int subtype, byte[] bytes)
public static Blob createBsonBinary(int subtype, byte[] bytes)Creates a new Blob instance representing a BSON binary data type with a specific subtype. Sets representation to BSON.
| Parameters | |
|---|---|
| Name | Description |
subtype |
intThe subtype to use for this instance. |
bytes |
byte[]The bytes to use for this Blob instance. |
| Returns | |
|---|---|
| Type | Description |
Blob |
The new Blob instance |
createBsonBinary(int subtype, ByteString data)
public static Blob createBsonBinary(int subtype, ByteString data)Creates a new Blob instance representing a BSON binary data type with a specific subtype. Sets representation to BSON.
| Parameters | |
|---|---|
| Name | Description |
subtype |
intThe subtype to use for this instance. |
data |
ByteStringThe ByteString to use for this Blob instance. |
| Returns | |
|---|---|
| Type | Description |
Blob |
The new Blob instance |
fromByteString(ByteString byteString)
public static Blob fromByteString(ByteString byteString)Creates a new Blob instance from the provided ByteString. Defaults to subtype 0 and native representation.
| Parameter | |
|---|---|
| Name | Description |
byteString |
ByteStringThe byteString to use for this Blob instance. |
| Returns | |
|---|---|
| Type | Description |
Blob |
The new Blob instance |
fromBytes(byte[] bytes)
public static Blob fromBytes(byte[] bytes)Creates a new Blob instance from the provided bytes. Makes a copy of the bytes passed in. Defaults to subtype 0 and native representation.
| Parameter | |
|---|---|
| Name | Description |
bytes |
byte[]The bytes to use for this Blob instance. |
| Returns | |
|---|---|
| Type | Description |
Blob |
The new Blob instance |
Methods
equals(Object obj)
public boolean equals(Object obj)Returns true if this Blob is equal to the provided object.
| Parameter | |
|---|---|
| Name | Description |
obj |
ObjectThe object to compare against. |
| Returns | |
|---|---|
| Type | Description |
boolean |
Whether this Blob is equal to the provided object. |
hashCode()
public int hashCode()| Returns | |
|---|---|
| Type | Description |
int |
|
subtype()
public int subtype()Returns the subtype of this binary data. Defaults to 0 for both native binary and BSON binary if not specified.
| Returns | |
|---|---|
| Type | Description |
int |
The subtype of the binary data. |
toByteString()
public ByteString toByteString()Returns the backing data as a ByteString.
| Returns | |
|---|---|
| Type | Description |
ByteString |
The bytes of this blob as a byteString |
toBytes()
public byte[] toBytes()Returns a copy of the underlying bytes as a byte[] array.
| Returns | |
|---|---|
| Type | Description |
byte[] |
The bytes of this blob as a byte[] array. |
toString()
public String toString()| Returns | |
|---|---|
| Type | Description |
String |
|