Package com.google.appengine.api.blobstore

Examples of com.google.appengine.api.blobstore.BlobstoreInputStream


 
  InputStream openXMLStream(BlobKey blobKeyHUDXML) {
    InputStream inputStream = null;
    try
      log.info("Using BlobstoreInputStream");
      inputStream = new BlobstoreInputStream(blobKeyHUDXML);
    } catch (Exception e) {
      log.info("Error reading from BlobstoreInputStream:" + e.toString());
    }     

    //unzip the input stream
View Full Code Here


  public static byte[] getMediaFromBlob(String key) {
    byte[] byteArray = null;
    BlobKey blobKey = new BlobKey(key);
    BlobInfo blobInfo = new BlobInfoFactory().loadBlobInfo(blobKey);
    BlobstoreInputStream stream;
    try {
      stream = new BlobstoreInputStream(blobKey);
      byteArray = new byte[(int) blobInfo.getSize()];
      stream.read(byteArray);
    } catch (IOException e) {
      e.printStackTrace();
    }
    return byteArray;
  }
View Full Code Here

  @Override
  public void beginSlice() throws IOException {
    Preconditions.checkState(in == null, "%s: Already initialized.", this);
    InputStream blobInputStream =
        new BlobstoreInputStream(new BlobKey(blobKey), startOffset + offset);
    in = new LineInputStream(blobInputStream, endOffset - startOffset - offset, terminator);
    skipRecordReadByPreviousShard();
  }
View Full Code Here

  public void beginSlice() throws IOException {
    Preconditions.checkState(recordIterator == null, "%s: Already initialized: %s",
        this, recordIterator);
    input = new CountingInputStream(
        new BufferedInputStream(
            new BlobstoreInputStream(new BlobKey(blobKey), startOffset + offset),
            DEFAULT_BUFFER_SIZE));
    recordIterator = new InputStreamIterator(input, endOffset - startOffset - offset,
        startOffset != 0L && offset == 0L,
        terminator);
  }
View Full Code Here

      DataStoreDirectory directory = new DataStoreDirectory(name);

      IndexTool tool = new IndexTool(directory);

      BlobstoreInputStream in = new BlobstoreInputStream(key);

      try {
        tool.importZip(in);
      } finally {
        in.close();
      }

      blobstoreService.delete(key);

      resp.sendRedirect("/index.jsp");
View Full Code Here

     * @param c the closure to execute, passing in the stream as parameter of the closure
     * @return the return value of the closure execution
     * @throws IOException
     */
    public static <T> T withStream(BlobKey selfKey, Closure<T> c) throws IOException {
        BlobstoreInputStream stream = new BlobstoreInputStream(selfKey);
        return IOGroovyMethods.withStream(stream, c);
    }
View Full Code Here

     * @param c the closure to execute, passing in the stream as parameter of the closure
     * @return the return value of the closure execution
     * @throws S
     */
    public static <T> T withReader(BlobKey selfKey, String encoding, Closure<T> c) throws IOException {
        BlobstoreInputStream stream = new BlobstoreInputStream(selfKey);
        return IOGroovyMethods.withReader(stream, encoding, c);
    }
View Full Code Here

    @Test
    public void testBlobInputStream() throws Exception {
        String CONTENT = "BlobInputStreamTest";
        BlobKey blobKey = writeNewBlobFile(CONTENT);

        BlobstoreInputStream stream = new BlobstoreInputStream(blobKey);
        assertEquals(CONTENT, toString(stream));
    }
View Full Code Here

    @Test
    public void testBlobInputStreamWithOffset() throws Exception {
        BlobKey blobKey = writeNewBlobFile("BlobInputStreamTest");

        int OFFSET = 4;
        BlobstoreInputStream stream = new BlobstoreInputStream(blobKey, OFFSET);
        assertEquals("InputStreamTest", toString(stream));
    }
View Full Code Here

TOP

Related Classes of com.google.appengine.api.blobstore.BlobstoreInputStream

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.