com.google.appengine.api.blobstore
Class BlobstoreInputStream
- java.lang.Object
-
- java.io.InputStream
-
- com.google.appengine.api.blobstore.BlobstoreInputStream
-
- All Implemented Interfaces:
- java.io.Closeable, java.lang.AutoCloseable
public final class BlobstoreInputStream extends java.io.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 and Description static class
BlobstoreInputStream.BlobstoreIOException
A subclass ofIOException
that indicates that there was a problem interacting with Blobstore.static class
BlobstoreInputStream.ClosedStreamException
A subclass ofIOException
that indicates operations on a stream after it is closed.
-
Constructor Summary
Constructors Constructor and 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 and Description void
close()
void
mark(int readlimit)
boolean
markSupported()
int
read()
int
read(byte[] b, int off, int len)
void
reset()
-
-
-
Constructor Detail
-
BlobstoreInputStream
public BlobstoreInputStream(BlobKey blobKey, long offset) throws java.io.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.java.lang.IllegalArgumentException
- Ifoffset
< 0.java.io.IOException
-
BlobstoreInputStream
public BlobstoreInputStream(BlobKey blobKey) throws java.io.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.java.lang.IllegalArgumentException
- Ifoffset
< 0.java.io.IOException
-
-
Method Detail
-
close
public void close() throws java.io.IOException
- Specified by:
close
in interfacejava.io.Closeable
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Overrides:
close
in classjava.io.InputStream
- Throws:
java.io.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 java.io.IOException
- Specified by:
read
in classjava.io.InputStream
- Throws:
java.io.IOException
-
read
public int read(byte[] b, int off, int len) throws java.io.IOException
- Overrides:
read
in classjava.io.InputStream
- Throws:
java.io.IOException
-
markSupported
public boolean markSupported()
- Overrides:
markSupported
in classjava.io.InputStream
-
mark
public void mark(int readlimit)
- Overrides:
mark
in classjava.io.InputStream
-
reset
public void reset() throws java.io.IOException
- Overrides:
reset
in classjava.io.InputStream
- Throws:
java.io.IOException
-
-