/** * Returns the optimal part size, in bytes, for each individual part upload * in a multipart upload. * * @param putObjectRequest * The request containing all the details of the upload. * @param configuration * Configuration values to use when calculating size. * * @return The optimal part size, in bytes, for each individual part upload * in a multipart upload. */ public static long calculateOptimalPartSize(PutObjectRequest putObjectRequest, TransferManagerConfiguration configuration) { double contentLength = TransferManagerUtils.getContentLength(putObjectRequest); double optimalPartSize = (double)contentLength / (double)MAXIMUM_UPLOAD_PARTS; // round up so we don't push the upload over the maximum number of parts optimalPartSize = Math.ceil(optimalPartSize); return (long)Math.max(optimalPartSize, configuration.getMinimumUploadPartSize()); }
/** * Captures the state of the upload. */ private void captureUploadStateIfPossible() { if (origReq.getSSECustomerKey() == null) { persistableUpload = new PersistableUpload(origReq.getBucketName(), origReq.getKey(), origReq.getFile() .getAbsolutePath(), multipartUploadId, configuration.getMinimumUploadPartSize(), configuration.getMultipartUploadThreshold()); notifyPersistableTransferAvailability(); } }
/** * Returns the optimal part size, in bytes, for each individual part upload * in a multipart upload. * * @param putObjectRequest * The request containing all the details of the upload. * @param configuration * Configuration values to use when calculating size. * * @return The optimal part size, in bytes, for each individual part upload * in a multipart upload. */ public static long calculateOptimalPartSize(PutObjectRequest putObjectRequest, TransferManagerConfiguration configuration) { double contentLength = TransferManagerUtils.getContentLength(putObjectRequest); double optimalPartSize = (double)contentLength / (double)MAXIMUM_UPLOAD_PARTS; // round up so we don't push the upload over the maximum number of parts optimalPartSize = Math.ceil(optimalPartSize); return (long)Math.max(optimalPartSize, configuration.getMinimumUploadPartSize()); }
/** * Captures the state of the upload. */ private void captureUploadStateIfPossible() { if (origReq.getSSECustomerKey() == null) { persistableUpload = new PersistableUpload(origReq.getBucketName(), origReq.getKey(), origReq.getFile() .getAbsolutePath(), multipartUploadId, configuration.getMinimumUploadPartSize(), configuration.getMultipartUploadThreshold()); notifyPersistableTransferAvailability(); } }