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 InputStream
asInputStream()
Returns anInputStream
for this blob content.ByteBuffer
asReadOnlyByteBuffer()
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
equals(Object obj)
int
getLength()
Returns the size of this blob.int
hashCode()
byte[]
toByteArray()
Returns a copy as byte array.String
toString()
-
-
-
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-onlyByteBuffer
for this blob content.
-
asInputStream
public InputStream asInputStream()
Returns anInputStream
for 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
-
-