Package com.google.cloud.datastore
Class Blob
java.lang.Object
com.google.cloud.datastore.Blob
- All Implemented Interfaces:
Serializable
A Google Cloud Datastore Blob. This class is immutable.
-
Method Summary
Modifier and TypeMethodDescriptionReturns anInputStreamfor this blob content.Returns a read-onlyByteBufferfor this blob content.static BlobcopyFrom(byte[] bytes) static BlobcopyFrom(InputStream input) static BlobcopyFrom(ByteBuffer bytes) voidcopyTo(byte[] target) Copies bytes into a buffer.voidcopyTo(ByteBuffer target) Copies bytes into a ByteBuffer.booleanintReturns the size of this blob.inthashCode()byte[]Returns a copy as byte array.toString()
-
Method Details
-
toString
-
hashCode
public int hashCode() -
equals
-
getLength
public int getLength()Returns the size of this blob. -
toByteArray
public byte[] toByteArray()Returns a copy as byte array. -
asReadOnlyByteBuffer
Returns a read-onlyByteBufferfor this blob content. -
asInputStream
Returns anInputStreamfor this blob content. -
copyTo
Copies bytes into a ByteBuffer.- Throws:
ReadOnlyBufferException- if the target is read-onlyBufferOverflowException- 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
-
copyFrom
-
copyFrom
- Throws:
IOException
-