org.jclouds.blobstore.BlobStore.uploadMultipartPart()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(5.7k)|赞(0)|评价(0)|浏览(117)

本文整理了Java中org.jclouds.blobstore.BlobStore.uploadMultipartPart()方法的一些代码示例,展示了BlobStore.uploadMultipartPart()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。BlobStore.uploadMultipartPart()方法的具体详情如下:
包路径:org.jclouds.blobstore.BlobStore
类名称:BlobStore
方法名:uploadMultipartPart

BlobStore.uploadMultipartPart介绍

暂无

代码示例

代码示例来源:origin: gaul/s3proxy

@Override
public MultipartPart uploadMultipartPart(MultipartUpload mpu,
    int partNumber, Payload payload) {
  MultipartPart part = delegate().uploadMultipartPart(mpu, partNumber,
      payload);
  return part;
}

代码示例来源:origin: gaul/s3proxy

@Override
public String completeMultipartUpload(final MultipartUpload mpu,
    final List<MultipartPart> parts) {
  long length = 0;
  for (MultipartPart part : parts) {
    length += part.partSize();
  }
  byte[] array = Longs.toByteArray(length);
  ByteSourcePayload payload = new ByteSourcePayload(
      ByteSource.wrap(array));
  super.abortMultipartUpload(mpu);
  MultipartPart part = delegate().uploadMultipartPart(mpu, 1, payload);
  return delegate().completeMultipartUpload(mpu, ImmutableList.of(part));
}

代码示例来源:origin: Nextdoor/bender

@Override
public MultipartPart uploadMultipartPart(MultipartUpload mpu,
    int partNumber, Payload payload) {
  MultipartPart part = delegate().uploadMultipartPart(mpu, partNumber,
      payload);
  return part;
}

代码示例来源:origin: org.gaul/s3proxy

@Override
public MultipartPart uploadMultipartPart(MultipartUpload mpu,
    int partNumber, Payload payload) {
  MultipartPart part = delegate().uploadMultipartPart(mpu, partNumber,
      payload);
  return part;
}

代码示例来源:origin: org.apache.jclouds/jclouds-blobstore

@Override
public MultipartPart uploadMultipartPart(MultipartUpload mpu, int partNumber, Payload payload) {
 return delegate().uploadMultipartPart(mpu, partNumber, payload);
}

代码示例来源:origin: com.amysta.jclouds/jclouds-blobstore

@Override
public MultipartPart uploadMultipartPart(MultipartUpload mpu, int partNumber, Payload payload) {
 return delegate().uploadMultipartPart(mpu, partNumber, payload);
}

代码示例来源:origin: apache/jclouds

@Override
public MultipartPart uploadMultipartPart(MultipartUpload mpu, int partNumber, Payload payload) {
 return delegate().uploadMultipartPart(mpu, partNumber, payload);
}

代码示例来源:origin: Nextdoor/bender

@Override
public MultipartPart uploadMultipartPart(MultipartUpload mpu, int partNumber, Payload payload) {
 return delegate().uploadMultipartPart(mpu, partNumber, payload);
}

代码示例来源:origin: Nextdoor/bender

@Override
public String completeMultipartUpload(final MultipartUpload mpu,
    final List<MultipartPart> parts) {
  long length = 0;
  for (MultipartPart part : parts) {
    length += part.partSize();
  }
  byte[] array = Longs.toByteArray(length);
  ByteSourcePayload payload = new ByteSourcePayload(
      ByteSource.wrap(array));
  super.abortMultipartUpload(mpu);
  MultipartPart part = delegate().uploadMultipartPart(mpu, 1, payload);
  return delegate().completeMultipartUpload(mpu, ImmutableList.of(part));
}

代码示例来源:origin: apache/jclouds

@Test(groups = { "integration", "live" })
public void testMultipartUploadMultiplePartsKnownETag() throws Exception {
 BlobStore blobStore = view.getBlobStore();
 String container = getContainerName();
 // Pre-computed ETag returned by AWS S3 for the MPU consisting of two 5MB parts filled with 'b'
 String expectedETag = "\"84462a16f6a60478d50148808aa609c1-2\"";
 int partSize = 5 * 1024 * 1024;
 try {
   String name = "blob-name";
   BlobBuilder blobBuilder = blobStore.blobBuilder(name);
   Blob blob = blobBuilder.build();
   MultipartUpload mpu = blobStore.initiateMultipartUpload(container, blob.getMetadata(), new PutOptions());
   byte[] content = new byte[partSize];
   Arrays.fill(content, (byte) 'b');
   Payload payload = Payloads.newByteArrayPayload(content);
   payload.getContentMetadata().setContentLength((long) partSize);
   MultipartPart part1 = blobStore.uploadMultipartPart(mpu, 1, payload);
   MultipartPart part2 = blobStore.uploadMultipartPart(mpu, 2, payload);
   blobStore.completeMultipartUpload(mpu, ImmutableList.of(part1, part2));
   BlobMetadata newBlobMetadata = blobStore.blobMetadata(container, name);
   assertThat(newBlobMetadata.getETag()).isEqualTo(expectedETag);
 } finally {
   returnContainer(container);
 }
}

代码示例来源:origin: apache/jclouds

@Test(groups = { "integration", "live" })
public void test10000PartMultipartUpload() throws Exception {
 BlobStore blobStore = view.getBlobStore();
 String container = getContainerName();
 int partSize = (int) blobStore.getMinimumMultipartPartSize();
 try {
   String name = "blob-name";
   BlobBuilder blobBuilder = blobStore.blobBuilder(name);
   Blob blob = blobBuilder.build();
   MultipartUpload mpu = blobStore.initiateMultipartUpload(container, blob.getMetadata(), new PutOptions());
   ImmutableList.Builder<MultipartPart> parts = ImmutableList.builder();
   byte[] content = new byte[partSize];
   for (int i = 0; i < 10 * 1000; ++i) {
    Payload payload = Payloads.newByteArrayPayload(content);
    payload.getContentMetadata().setContentLength((long) partSize);
    parts.add(blobStore.uploadMultipartPart(mpu, i, payload));
   }
   blobStore.completeMultipartUpload(mpu, parts.build());
   BlobMetadata newBlobMetadata = blobStore.blobMetadata(container, name);
   assertThat(newBlobMetadata.getSize()).isEqualTo(10 * 1000 * partSize);
 } finally {
   returnContainer(container);
 }
}

代码示例来源:origin: apache/jclouds

payload1.getContentMetadata().setContentLength(byteSource1.size());
payload2.getContentMetadata().setContentLength(byteSource2.size());
MultipartPart part1 = blobStore.uploadMultipartPart(mpu, 1, payload1);
MultipartPart part2 = blobStore.uploadMultipartPart(mpu, 2, payload2);

代码示例来源:origin: apache/jclouds

Payload payload = Payloads.newByteSourcePayload(byteSource);
payload.getContentMetadata().setContentLength(byteSource.size());
MultipartPart part = blobStore.uploadMultipartPart(mpu, 1, payload);

代码示例来源:origin: apache/jclouds

payload1.getContentMetadata().setContentLength(byteSource1.size());
payload2.getContentMetadata().setContentLength(byteSource2.size());
MultipartPart part1 = blobStore.uploadMultipartPart(mpu, 1, payload1);
MultipartPart part2 = blobStore.uploadMultipartPart(mpu, 2, payload2);

相关文章