Package com.google.cloud.datastore
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.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description InputStreamasInputStream()Returns anInputStreamfor this blob content.ByteBufferasReadOnlyByteBuffer()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.booleanequals(Object obj)intgetLength()Returns the size of this blob.inthashCode()byte[]toByteArray()Returns a copy as byte array.StringtoString()
-
-
-
Method Detail
-
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-onlyByteBufferfor this blob content.
-
asInputStream
public InputStream asInputStream()
Returns anInputStreamfor this blob content.
-
copyTo
public void copyTo(ByteBuffer target)
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
public static Blob copyFrom(byte[] bytes)
-
copyFrom
public static Blob copyFrom(ByteBuffer bytes)
-
copyFrom
public static Blob copyFrom(InputStream input) throws IOException
- Throws:
IOException
-
-