Class Blob

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

public final class Blob extends Object implements Serializable
A Google Cloud Datastore Blob. This class is immutable.
See Also:
  • Method Details

    • toString

      public String toString()
      Overrides:
      toString in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • getLength

      public int getLength()
      Returns the size of this blob.
    • toByteArray

      public byte[] toByteArray()
      Returns a copy as byte array.
    • asReadOnlyByteBuffer

      public ByteBuffer asReadOnlyByteBuffer()
      Returns a read-only ByteBuffer for this blob content.
    • asInputStream

      public InputStream asInputStream()
      Returns an InputStream for this blob content.
    • copyTo

      public void copyTo(ByteBuffer target)
      Copies bytes into a ByteBuffer.
      Throws:
      ReadOnlyBufferException - if the target is read-only
      BufferOverflowException - if the target's remaining() space is not large enough to hold the data
    • copyTo

      public void copyTo(byte[] target)
      Copies bytes into a buffer.
      Throws:
      IndexOutOfBoundsException - if an offset or size is negative or too large
    • copyFrom

      public static Blob copyFrom(byte[] bytes)
    • copyFrom

      public static Blob copyFrom(ByteBuffer bytes)
    • copyFrom

      public static Blob copyFrom(InputStream input) throws IOException
      Throws:
      IOException