/** * Uploads part async. */ private void uploadPart() throws IOException { if (mFile == null) { return; } mLocalOutputStream.close(); int partNumber = mPartNumber.getAndIncrement(); File newFileToUpload = new File(mFile.getPath()); mFile = null; mLocalOutputStream = null; UploadPartRequest uploadRequest = new UploadPartRequest() .withBucketName(mBucketName) .withKey(mKey) .withUploadId(mUploadId) .withPartNumber(partNumber) .withFile(newFileToUpload) .withPartSize(newFileToUpload.length()); execUpload(uploadRequest); }
.withPartNumber(partNumber) .withFile(mFile) .withPartSize(mFile.length()); uploadRequest.setLastPart(true); execUpload(uploadRequest);
.withInputStream(chunk) .withPartNumber(partNumber) .withPartSize(partSize) .withLastPart(isLastPart); partETags.add( getS3Client().uploadPart(uploadRequest).getPartETag() );
/** * Creates and returns an upload-part request corresponding to a ciphertext * file upon a part-creation event. * * @param event * the part-creation event of the ciphertxt file. * @param part * the created ciphertext file corresponding to the upload-part */ protected UploadPartRequest newUploadPartRequest(PartCreationEvent event, final File part) { final UploadPartRequest reqUploadPart = new UploadPartRequest() .withBucketName(req.getBucketName()) .withFile(part) .withKey(req.getKey()) .withPartNumber(event.getPartNumber()) .withPartSize(part.length()) .withLastPart(event.isLastPart()) .withUploadId(uploadId) .withObjectMetadata(req.getUploadPartMetadata()) ; return reqUploadPart; }
.withInputStream(in) .withPartNumber(part) .withPartSize(thisPartSize); try { UploadPartResult uploadPartResult = s3.uploadPart(uploadRequest);
.withInputStream(new InputSubstream(wrappedStream, 0, partSize, isLastPart)) .withPartNumber(partNumber++) .withPartSize(partSize); } else { req = new UploadPartRequest() .withFileOffset(offset) .withPartNumber(partNumber++) .withPartSize(partSize);
.withPartNumber( c.getInt(c.getColumnIndexOrThrow(TransferTable.COLUMN_PART_NUM))) .withPartSize( c.getLong(c.getColumnIndexOrThrow(TransferTable.COLUMN_BYTES_TOTAL))) .withLastPart(1 == c.getInt(c
.withFileOffset(filePosition) .withFile(file) .withPartSize(partSize); partETags.add(s3Client.uploadPart(uploadRequest).getPartETag()); filePosition += partSize;
/** * Creates and returns an upload-part request corresponding to a ciphertext * file upon a part-creation event. * * @param event * the part-creation event of the ciphertxt file. * @param part * the created ciphertext file corresponding to the upload-part */ protected UploadPartRequest newUploadPartRequest(PartCreationEvent event, final File part) { final UploadPartRequest reqUploadPart = new UploadPartRequest() .withBucketName(req.getBucketName()) .withFile(part) .withKey(req.getKey()) .withPartNumber(event.getPartNumber()) .withPartSize(part.length()) .withLastPart(event.isLastPart()) .withUploadId(uploadId) .withObjectMetadata(req.getUploadPartMetadata()); return reqUploadPart; }
isLastPart)) .withPartNumber(partNumber++) .withPartSize(partSize); } else { request = new UploadPartRequest() .withFileOffset(offset) .withPartNumber(partNumber++) .withPartSize(partSize);
final String uploadId = "6E1pXqay7WGHDsWKZ2vuGlba548bNcLNnwTyTnoxiOFQ6S9hejT_dhBpvA0jLAD04oSLOy6R7hrsFFy00O15MoLYD0heUeOn6SglTE6SKWA-"; upr.withUploadId(uploadId).withPartNumber(1) .withPartSize("multipartContent".getBytes(StringUtils.UTF8).length) .withBucketName("test-bucket123456") .withKey("multi-key")
public void uploadPart(ByteArrayInputStream inputStream, int partSize) { int currentPartNumber = partETags.size() + 1; UploadPartRequest request = new UploadPartRequest() .withBucketName(bucket) .withKey(key) .withUploadId(uploadId) .withInputStream(inputStream) .withPartNumber(currentPartNumber) .withPartSize(partSize) .withGeneralProgressListener(progressListener); log.debug("Uploading part {} for id '{}'", currentPartNumber, uploadId); partETags.add(s3.uploadPart(request).getPartETag()); }
public void uploadPart(ByteArrayInputStream inputStream, int partSize) { int currentPartNumber = partETags.size() + 1; UploadPartRequest request = new UploadPartRequest() .withBucketName(bucket) .withKey(key) .withUploadId(uploadId) .withInputStream(inputStream) .withPartNumber(currentPartNumber) .withPartSize(partSize) .withGeneralProgressListener(progressListener); log.debug("Uploading part {} for id '{}'", currentPartNumber, uploadId); partETags.add(s3.uploadPart(request).getPartETag()); }
private void uploadStreamPart(StreamPart part) { log.debug("{}: Uploading {}", this, part); UploadPartRequest uploadRequest = new UploadPartRequest() .withBucketName(bucketName).withKey(putKey) .withUploadId(uploadId).withPartNumber(part.getPartNumber()) .withInputStream(part.getInputStream()) .withPartSize(part.size()); customiseUploadPartRequest(uploadRequest); UploadPartResult uploadPartResult = s3Client.uploadPart(uploadRequest); PartETag partETag = uploadPartResult.getPartETag(); partETags.add(partETag); log.info("{}: Finished uploading {}", this, part); }
@Override public UploadPartResult call() throws Exception { try { return this.amazonS3.uploadPart(new UploadPartRequest().withBucketName(this.bucketName). withKey(this.key). withUploadId(this.uploadId). withInputStream(new ByteArrayInputStream(this.content)). withPartNumber(this.partNumber). withLastPart(this.last). withPartSize(this.contentLength)); } finally { //Release the memory, as the callable may still live inside the CompletionService which would cause // an exhaustive memory usage this.content = null; } } }
@Override public UploadPartResult call() throws Exception { try { return this.amazonS3.uploadPart(new UploadPartRequest().withBucketName(this.bucketName). withKey(this.key). withUploadId(this.uploadId). withInputStream(new ByteArrayInputStream(this.content)). withPartNumber(this.partNumber). withLastPart(this.last). withPartSize(this.contentLength)); } finally { //Release the memory, as the callable may still live inside the CompletionService which would cause // an exhaustive memory usage this.content = null; } } }
PartETag upload(String uploadId, S3Part part) { Object[] logParams = new Object[] { part.getSize(), part.getNumber(), bucket, key }; log.info("Uploading {} bytes for part {} to s3://{}/{}.", logParams); UploadPartRequest request = new UploadPartRequest() .withUploadId(uploadId) .withBucketName(bucket) .withKey(key) .withPartNumber(part.getNumber()) .withPartSize(part.getSize()) .withMD5Digest(part.getMd5()) .withInputStream(part.getInputStream()); UploadPartResult result = s3.uploadPart(request); log.info("Uploaded {} bytes for part {} to s3://{}/{}.", logParams); bytes += part.getSize(); return result.getPartETag(); }
protected PartETag doUploadMultipart(S3BlobStore blobStore, String bucketName, String blobName, String uploadId, InputStream is, int length, boolean lastPart) throws AmazonS3Exception { UploadPartRequest request = new UploadPartRequest() .withBucketName(bucketName) .withKey(blobName) .withUploadId(uploadId) .withPartNumber(multipartChunks) .withInputStream(is) .withPartSize(length) .withLastPart(lastPart); UploadPartResult response = blobStore.client().uploadPart(request); return response.getPartETag(); }
/** * Creates and returns an upload-part request corresponding to a ciphertext * file upon a part-creation event. * * @param event * the part-creation event of the ciphertxt file. * @param part * the created ciphertext file corresponding to the upload-part */ protected UploadPartRequest newUploadPartRequest(PartCreationEvent event, final File part) { final UploadPartRequest reqUploadPart = new UploadPartRequest() .withBucketName(req.getBucketName()) .withFile(part) .withKey(req.getKey()) .withPartNumber(event.getPartNumber()) .withPartSize(part.length()) .withLastPart(event.isLastPart()) .withUploadId(uploadId) .withObjectMetadata(req.getUploadPartMetadata()) ; return reqUploadPart; }
/** * Creates and returns an upload-part request corresponding to a ciphertext * file upon a part-creation event. * * @param event * the part-creation event of the ciphertxt file. * @param part * the created ciphertext file corresponding to the upload-part */ protected UploadPartRequest newUploadPartRequest(PartCreationEvent event, final File part) { final UploadPartRequest reqUploadPart = new UploadPartRequest() .withBucketName(req.getBucketName()) .withFile(part) .withKey(req.getKey()) .withPartNumber(event.getPartNumber()) .withPartSize(part.length()) .withLastPart(event.isLastPart()) .withUploadId(uploadId) .withObjectMetadata(req.getUploadPartMetadata()); return reqUploadPart; }