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 anInputStream
for this blob content.Returns a read-onlyByteBuffer
for this blob content.static Blob
copyFrom
(byte[] bytes) static Blob
copyFrom
(InputStream input) static Blob
copyFrom
(ByteBuffer bytes) void
copyTo
(byte[] target) Copies bytes into a buffer.void
copyTo
(ByteBuffer target) Copies bytes into a ByteBuffer.boolean
int
Returns the size of this blob.int
hashCode()
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-onlyByteBuffer
for this blob content. -
asInputStream
Returns anInputStream
for 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
-