Class BlobstoreInputStream
- java.lang.Object
-
- java.io.InputStream
-
- com.google.appengine.api.blobstore.BlobstoreInputStream
-
- All Implemented Interfaces:
Closeable,AutoCloseable
public final class BlobstoreInputStream extends InputStream
BlobstoreInputStream provides an InputStream view of a blob in Blobstore. It is thread compatible but not thread safe: there is no static state, but any multithreaded use must be externally synchronized.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classBlobstoreInputStream.BlobstoreIOExceptionA subclass ofIOExceptionthat indicates that there was a problem interacting with Blobstore.static classBlobstoreInputStream.ClosedStreamExceptionA subclass ofIOExceptionthat indicates operations on a stream after it is closed.
-
Constructor Summary
Constructors Constructor Description BlobstoreInputStream(BlobKey blobKey)Creates a BlobstoreInputStream that reads data from the blob indicated by blobKey, starting at the beginning of the blob.BlobstoreInputStream(BlobKey blobKey, long offset)Creates a BlobstoreInputStream that reads data from the blob indicated by blobKey, starting at offset.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()voidmark(int readlimit)booleanmarkSupported()intread()intread(byte[] b, int off, int len)voidreset()-
Methods inherited from class java.io.InputStream
available, read, skip
-
-
-
-
Constructor Detail
-
BlobstoreInputStream
public BlobstoreInputStream(BlobKey blobKey, long offset) throws IOException
Creates a BlobstoreInputStream that reads data from the blob indicated by blobKey, starting at offset.- Parameters:
blobKey- A valid BlobKey indicating the blob to read from.offset- An offset to start from.- Throws:
BlobstoreInputStream.BlobstoreIOException- If the blobKey given is invalid.IllegalArgumentException- Ifoffset< 0.IOException
-
BlobstoreInputStream
public BlobstoreInputStream(BlobKey blobKey) throws IOException
Creates a BlobstoreInputStream that reads data from the blob indicated by blobKey, starting at the beginning of the blob.- Parameters:
blobKey- A valid BlobKey indicating the blob to read from.- Throws:
BlobstoreInputStream.BlobstoreIOException- If the blobKey given is invalid.IllegalArgumentException- Ifoffset< 0.IOException
-
-
Method Detail
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classInputStream- Throws:
IOException- - does not actually throw but as it's part of our public API and removing it can cause compilation errors, leaving it in (and documenting to quiet Eclipse warning).
-
read
public int read() throws IOException- Specified by:
readin classInputStream- Throws:
IOException
-
read
public int read(byte[] b, int off, int len) throws IOException- Overrides:
readin classInputStream- Throws:
IOException
-
markSupported
public boolean markSupported()
- Overrides:
markSupportedin classInputStream
-
mark
public void mark(int readlimit)
- Overrides:
markin classInputStream
-
reset
public void reset() throws IOException- Overrides:
resetin classInputStream- Throws:
IOException
-
-