Package com.google.appengine.api.blobstore

Examples of com.google.appengine.api.blobstore.BlobstoreService.fetchData()


        Map<String, List<BlobKey>> blobs = blobService.getUploads(req);
        List<BlobKey> blobKeys = blobs.get("template");
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        if (blobKeys != null && blobKeys.size() > 0) {
          for (BlobKey blobKey : blobKeys) {
            b = blobService.fetchData(blobKey, 0, 20);
            if (b.length > 0) {
              FileService fileService = FileServiceFactory
                  .getFileService();
              AppEngineFile file = fileService
                  .getBlobFile(blobKey);
View Full Code Here


            Map<String, List<BlobKey>> blobs = blobService
                .getUploads(req);
            List<BlobKey> blobKeys = blobs.get("img");
            if (blobKeys != null && blobKeys.size() > 0) {
              for (BlobKey blobKey : blobKeys) {
                byte[] arr = blobService.fetchData(blobKey, 0,
                    20);
                if (arr.length > 0) {
                  obj.setThumb(imageService
                      .getServingUrl(blobKey));
                }
View Full Code Here

          Map<String, List<BlobKey>> blobs = blobService
              .getUploads(req);
          List<BlobKey> blobKeys = blobs.get("img");
          if (blobKeys != null && blobKeys.size() > 0) {
            for (BlobKey blobKey : blobKeys) {
              byte[] arr = blobService.fetchData(blobKey, 0, 20);
              if (arr.length > 0) {
                obj.setThumb(imageService
                    .getServingUrl(blobKey));
              }
            }
View Full Code Here

          contentRangeHeader = String.format("bytes %d-%d/%d", previousByte, lastByte,
            photoEntry.getOriginalFileSize());
         
          BlobstoreService blobstoreService = BlobstoreServiceFactory.getBlobstoreService();
          bytes = blobstoreService.fetchData(photoEntry.getBlobKey(), previousByte, lastByte);
        } else {
          bytes = dataChunkDao.getBytes(photoEntry.getId(), previousByte);
         
          if (bytes == null) {
            throw new IllegalArgumentException(String.format("PhotoEntry with id '%s' does not "
View Full Code Here

      message.setTextBody("YouTube Direct was unable to upload a photo submission to Picasa.\n\n"
          + "There might be a service issue, or your Picasa configuration might be incorrect.\n\n"
          + "The photo in question is attached.");

      BlobstoreService blobstoreService = BlobstoreServiceFactory.getBlobstoreService();
      byte[] photoBytes = blobstoreService.fetchData(
          photoEntry.getBlobKey(), 0, photoEntry.getOriginalFileSize() - 1);

      MailService.Attachment photoAttachment =
          new MailService.Attachment(photoEntry.getOriginalFileName(), photoBytes);
      message.setAttachments(photoAttachment);
View Full Code Here

      final BlobstoreService blobstoreService = BlobstoreServiceFactory
          .getBlobstoreService();

      BlobInfo info = new BlobInfoFactory().loadBlobInfo(csvBlobKey);

      byte[] bytes = blobstoreService.fetchData(csvBlobKey, 0,
          info.getSize());

      final ZipInputStream zipIn = new ZipInputStream(
          new ByteArrayInputStream(bytes));
View Full Code Here

        response.setContentLength((int) blobInfo.getSize());
        response.setHeader(
            "Content-disposition",
            "attachment;" + blobInfo.getFilename());
        byte[] data =
            blobstoreService.fetchData(blobKey, 0, blobInfo.getSize());
        response.getOutputStream().write(data);
        response.flushBuffer();
        return null;
    }
View Full Code Here

  }

  private void assertImageDoesNotExist(String imageKey) {
    BlobstoreService bs = BlobstoreServiceFactory.getBlobstoreService();
    try {
      bs.fetchData(new BlobKey(imageKey), 0, 1);
      fail();
    } catch (IllegalArgumentException e) {
      // OK
    }
  }
View Full Code Here

            IOUtils.copy(Channels.newChannel(new ByteArrayInputStream(bytes)), out);
        }

        BlobstoreService blobstoreService = BlobstoreServiceFactory.getBlobstoreService();
        BlobKey key =  blobstoreService.createGsBlobKey("/gs/GcsBucket/" + ts);
        byte[] fetched = blobstoreService.fetchData(key, 0, 10);
        Assert.assertArrayEquals(bytes, fetched);
    }
}
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.