Package org.jclouds.io.payloads

Examples of org.jclouds.io.payloads.InputStreamSupplierPayload


      }
      return new InputStreamPayload(ByteStreams.limit(content, length));
   }

   protected Payload doSlice(InputSupplier<? extends InputStream> content, long offset, long length) {
      return new InputStreamSupplierPayload(ByteStreams.slice(content, offset, length));
   }
View Full Code Here


   protected Payload doSlice(byte[] content, long offset, long length) {
      Payload returnVal;
      checkArgument(offset <= Integer.MAX_VALUE, "offset is too big for an array");
      checkArgument(length <= Integer.MAX_VALUE, "length is too big for an array");
      returnVal = new InputStreamSupplierPayload(
            ByteStreams.newInputStreamSupplier(content, (int) offset, (int) length));
      return returnVal;
   }
View Full Code Here

   private void uploadInputSupplier(String container, String name, String contentDisposition,
         InputSupplier<? extends InputStream> supplier) throws IOException {
      BlobStore blobStore = view.getBlobStore();
      blobStore.putBlob(container, blobStore.blobBuilder(name)
            .payload(new InputStreamSupplierPayload(supplier))
            .contentType("text/plain")
            .contentMD5(md5Supplier(supplier))
            .contentLength(ByteStreams.length(supplier))
            .contentDisposition(contentDisposition)
            .build());
View Full Code Here

      }
      return new InputStreamPayload(ByteStreams.limit(content, length));
   }

   protected Payload doSlice(InputSupplier<? extends InputStream> content, long offset, long length) {
      return new InputStreamSupplierPayload(ByteStreams.slice(content, offset, length));
   }
View Full Code Here

   protected Payload doSlice(byte[] content, long offset, long length) {
      Payload returnVal;
      checkArgument(offset <= Integer.MAX_VALUE, "offset is too big for an array");
      checkArgument(length <= Integer.MAX_VALUE, "length is too big for an array");
      returnVal = new InputStreamSupplierPayload(
            ByteStreams.newInputStreamSupplier(content, (int) offset, (int) length));
      return returnVal;
   }
View Full Code Here

   private void uploadInputSupplier(String container, String name, String contentDisposition,
         InputSupplier<? extends InputStream> supplier) throws IOException {
      BlobStore blobStore = view.getBlobStore();
      blobStore.putBlob(container, blobStore.blobBuilder(name)
            .payload(new InputStreamSupplierPayload(supplier))
            .contentType("text/plain")
            .contentMD5(md5Supplier(supplier))
            .contentLength(ByteStreams.length(supplier))
            .contentDisposition(contentDisposition)
            .build());
View Full Code Here

      }
   }

   protected Payload doSlice(final FSDataInputStream inputStream,
         final long offset, final long length) {
      return new InputStreamSupplierPayload(new InputSupplier<InputStream>() {
         public InputStream getInput() throws IOException {
            if (offset > 0) {
               try {
                  inputStream.seek(offset);
               } catch (IOException e) {
View Full Code Here

      }
      return copyMetadataAndSetLength(input, returnVal, length);
   }

   protected Payload doSlice(Payload content, long offset, long length) {
      return new InputStreamSupplierPayload(ByteStreams.slice(content, offset, length));
   }
View Full Code Here

   protected Payload doSlice(String content, long offset, long length) {
      return doSlice(content.getBytes(), offset, length);
   }

   protected Payload doSlice(File content, long offset, long length) {
      return new InputStreamSupplierPayload(ByteStreams.slice(Files.newInputStreamSupplier(content), offset, length));
   }
View Full Code Here

   protected Payload doSlice(byte[] content, long offset, long length) {
      Payload returnVal;
      checkArgument(offset <= Integer.MAX_VALUE, "offset is too big for an array");
      checkArgument(length <= Integer.MAX_VALUE, "length is too big for an array");
      returnVal = new InputStreamSupplierPayload(
            ByteStreams.newInputStreamSupplier(content, (int) offset, (int) length));
      return returnVal;
   }
View Full Code Here

TOP

Related Classes of org.jclouds.io.payloads.InputStreamSupplierPayload

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.