Notice: Over the next few months, we're reorganizing the App Engine documentation site to make it easier to find content and better align with the rest of Google Cloud products. The same content will be available, but the navigation will now match the rest of the Cloud products.

BlobstoreInputStream (Google App Engine API for Java)

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.
    • 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() 
      • Methods inherited from class java.io.InputStream

        available, 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

      • close

        public void close()
                   throws java.io.IOException
        Specified by:
        close in interface java.io.Closeable
        Specified by:
        close in interface java.lang.AutoCloseable
        Overrides:
        close in class java.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 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