public class TransferManagerUtils extends Object
Constructor and Description |
---|
TransferManagerUtils() |
Modifier and Type | Method and Description |
---|---|
static long |
calculateOptimalPartSize(PutObjectRequest putObjectRequest,
TransferManagerConfiguration configuration)
Returns the optimal part size, in bytes, for each individual part upload
in a multipart upload.
|
static long |
calculateOptimalPartSizeForCopy(CopyObjectRequest copyObjectRequest,
TransferManagerConfiguration configuration,
long contentLengthOfSource)
Calculates the optimal part size of each part request if the copy
operation is carried out as multi-part copy.
|
static ThreadPoolExecutor |
createDefaultExecutorService()
Returns a new thread pool configured with the default settings.
|
static PauseStatus |
determinePauseStatus(Transfer.TransferState transferState,
boolean forceCancel)
Determines the pause status based on the current state of transfer.
|
static long |
getContentLength(PutObjectRequest putObjectRequest)
Returns the size of the data in this request, otherwise -1 if the content
length is unknown.
|
static Long |
getContentLengthFromContentRange(ObjectMetadata metadata)
Returns the content length of the object if response contains the Content-Range header
and is well formed.
|
static File |
getRequestFile(PutObjectRequest putObjectRequest)
Convenience method for getting the file specified in a request.
|
static boolean |
isDownloadParallelizable(AmazonS3 s3,
GetObjectRequest getObjectRequest,
Integer partCount)
Returns true if the specified download request can use parallel part
downloads for increased performance.
|
static boolean |
isUploadParallelizable(PutObjectRequest putObjectRequest,
boolean isUsingEncryption)
Returns true if the specified upload request can use parallel part
uploads for increased performance.
|
static boolean |
shouldUseMultipartUpload(PutObjectRequest putObjectRequest,
TransferManagerConfiguration configuration)
Returns true if the the specified request should be processed as a
multipart upload (instead of a single part upload).
|
public static ThreadPoolExecutor createDefaultExecutorService()
public static boolean isUploadParallelizable(PutObjectRequest putObjectRequest, boolean isUsingEncryption)
putObjectRequest
- The request to check.isUsingEncryption
- True if the upload is an encrypted upload, otherwise false.public static long getContentLength(PutObjectRequest putObjectRequest)
putObjectRequest
- The request to check.public static long calculateOptimalPartSize(PutObjectRequest putObjectRequest, TransferManagerConfiguration configuration)
putObjectRequest
- The request containing all the details of the upload.configuration
- Configuration values to use when calculating size.public static boolean shouldUseMultipartUpload(PutObjectRequest putObjectRequest, TransferManagerConfiguration configuration)
putObjectRequest
- The request containing all the details of the upload.configuration
- Configuration settings controlling how transfer manager
processes requests.public static File getRequestFile(PutObjectRequest putObjectRequest)
public static long calculateOptimalPartSizeForCopy(CopyObjectRequest copyObjectRequest, TransferManagerConfiguration configuration, long contentLengthOfSource)
copyObjectRequest
- the original request.configuration
- configuration containing the default part size.contentLengthOfSource
- content length of the Amazon S3 object.public static PauseStatus determinePauseStatus(Transfer.TransferState transferState, boolean forceCancel)
public static boolean isDownloadParallelizable(AmazonS3 s3, GetObjectRequest getObjectRequest, Integer partCount)
getObjectRequest
- The request to check.s3
- The Amazon s3 client.public static Long getContentLengthFromContentRange(ObjectMetadata metadata)
Copyright © 2024. All rights reserved.