com.google.appengine.api.blobstore
Class BlobstoreInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by com.google.appengine.api.blobstore.BlobstoreInputStream
All Implemented Interfaces:
java.io.Closeable

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
static class BlobstoreInputStream.BlobstoreIOException
          A subclass of IOException that indicates that there was a problem interacting with Blobstore.
 
Constructor Summary
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
 void mark(int readlimit)
           
 boolean markSupported()
           
 int read()
           
 int read(byte[] b, int off, int len)
           
 void reset()
           
 
Methods inherited from class java.io.InputStream
available, close, read, skip
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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 - If offset < 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 - If offset < 0.
java.io.IOException
Method Detail

read

public int read()
         throws java.io.IOException
Specified by:
read in class java.io.InputStream
Throws:
java.io.IOException

read

public int read(byte[] b,
                int off,
                int len)
         throws java.io.IOException
Overrides:
read in class java.io.InputStream
Throws:
java.io.IOException

markSupported

public boolean markSupported()
Overrides:
markSupported in class java.io.InputStream

mark

public void mark(int readlimit)
Overrides:
mark in class java.io.InputStream

reset

public void reset()
           throws java.io.IOException
Overrides:
reset in class java.io.InputStream
Throws:
java.io.IOException