Class Blob

java.lang.Object
com.google.cloud.firestore.Blob
All Implemented Interfaces:
Serializable

public final class Blob extends Object implements Serializable
Immutable class representing an array of bytes in Firestore.
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Returns true if this Blob is equal to the provided object.
    static Blob
    fromBytes(byte[] bytes)
    Creates a new Blob instance from the provided bytes.
    static Blob
    fromByteString(com.google.protobuf.ByteString byteString)
    Creates a new Blob instance from the provided ByteString.
    int
     
    byte[]
    Returns a copy of the underlying bytes as a byte[] array.
    com.google.protobuf.ByteString
    Returns the backing data as a ByteString.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • fromByteString

      @Nonnull public static Blob fromByteString(@Nonnull com.google.protobuf.ByteString byteString)
      Creates a new Blob instance from the provided ByteString.
      Parameters:
      byteString - The byteString to use for this Blob instance.
      Returns:
      The new Blob instance
    • fromBytes

      @Nonnull public static Blob fromBytes(@Nonnull byte[] bytes)
      Creates a new Blob instance from the provided bytes. Makes a copy of the bytes passed in.
      Parameters:
      bytes - The bytes to use for this Blob instance.
      Returns:
      The new Blob instance
    • toByteString

      @Nonnull public com.google.protobuf.ByteString toByteString()
      Returns the backing data as a ByteString.
      Returns:
      The bytes of this blob as a byteString
    • toBytes

      @Nonnull public byte[] toBytes()
      Returns a copy of the underlying bytes as a byte[] array.
      Returns:
      The bytes of this blob as a byte[] array.
    • equals

      public boolean equals(Object obj)
      Returns true if this Blob is equal to the provided object.
      Overrides:
      equals in class Object
      Parameters:
      obj - The object to compare against.
      Returns:
      Whether this Blob is equal to the provided object.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object