Package org.jclouds.io.payloads

Examples of org.jclouds.io.payloads.ByteSourcePayload


   public static ByteArrayPayload newByteArrayPayload(byte[] data) {
      return new ByteArrayPayload(checkNotNull(data, "data"));
   }

   public static ByteSourcePayload newByteSourcePayload(ByteSource data) {
      return new ByteSourcePayload(checkNotNull(data, "data"));
   }
View Full Code Here


   public void testIterableSliceWithRepeatingByteSource() throws IOException {
      String content = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\n"; /* 53 chars */
      byte[] contentBytes = content.getBytes(Charsets.UTF_8);
      ByteSource byteSource = ByteSources.repeatingArrayByteSource(contentBytes).slice(0, 1024);
      PayloadSlicer slicer = new BasePayloadSlicer();
      Payload payload = new ByteSourcePayload(byteSource);

      assertEquals(Iterables.size(slicer.slice(payload, 100)), 11);
      assertEquals(Iterables.size(slicer.slice(payload, 53)), 20);
   }
View Full Code Here

      }
   }

   public void testExtractArchive() throws Exception {
      for (String regionId : regions) {
         Payload payload = new ByteSourcePayload(ByteSource.wrap(tarGz));

         ExtractArchiveResponse extractResponse = api.getBulkApi(regionId)
                                                     .extractArchive(containerName, payload, "tar.gz");
         assertEquals(extractResponse.getCreated(), OBJECT_COUNT);
         assertTrue(extractResponse.getErrors().isEmpty());
View Full Code Here

         overrides.setProperty(PROPERTY_MAX_RETRIES, 0 + ""); // 0 retries == 1 try. Semantics.
         overrides.setProperty(PROPERTY_RETRY_DELAY_START, 0 + ""); // exponential backoff already working for this call. This is the delay BETWEEN attempts.

         final SwiftApi api = api(server.getUrl("/").toString(), "openstack-swift", overrides);

         api.getObjectApi("DFW", "myContainer").put("myObject", new ByteSourcePayload(ByteSource.wrap("swifty".getBytes())), metadata(metadata));

         fail("testReplaceTimeout test should have failed with an HttpResponseException.");
      } finally {
         server.shutdown();
      }
View Full Code Here

   private void uploadByteSource(String container, String name, String contentDisposition,
         ByteSource byteSource) throws IOException {
      BlobStore blobStore = view.getBlobStore();
      blobStore.putBlob(container, blobStore.blobBuilder(name)
            .payload(new ByteSourcePayload(byteSource))
            .contentType("text/plain")
            .contentMD5(byteSource.hash(md5()))
            .contentLength(byteSource.size())
            .contentDisposition(contentDisposition)
            .build());
View Full Code Here

   }

   @Test(groups = { "integration", "live" })
   public void testPutObjectStream() throws InterruptedException, IOException, ExecutionException {
      PayloadBlobBuilder blobBuilder = view.getBlobStore().blobBuilder("streaming").payload(
               new ByteSourcePayload(ByteSource.wrap("foo".getBytes())));
      addContentMetadata(blobBuilder);

      Blob blob = blobBuilder.build();

      String container = getContainerName();
View Full Code Here

TOP

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

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.