Class MultipartDownloadUtils
java.lang.Object
software.amazon.awssdk.services.s3.internal.multipart.MultipartDownloadUtils
-
Method Summary
Modifier and TypeMethodDescriptionstatic longcalculateTotalParts(long contentLength, long partSize) Calculates the total number of parts needed to download an object of the given size.completedParts(GetObjectRequest request) This method checks theS3MultipartExecutionAttribute.MULTIPART_DOWNLOAD_RESUME_CONTEXTexecution attributes for a context object and returns the complete parts associated with it, or an empty list of no context is found.This method checks theS3MultipartExecutionAttribute.MULTIPART_DOWNLOAD_RESUME_CONTEXTexecution attributes for a context object and returns it if it finds one.multipartDownloadResumeContext(S3Request request) This method checks theS3MultipartExecutionAttribute.MULTIPART_DOWNLOAD_RESUME_CONTEXTexecution attributes for a context object and returns it if it finds one.static long[]parseContentRange(String contentRange) Parses start byte and end byte from a Content-Range header.parseContentRangeForTotalSize(String contentRange) Parses the total size from a Content-Range header.static <T> AsyncResponseTransformer.SplitResult<GetObjectResponse, T> splitWithResponseRewrite(AsyncResponseTransformer<GetObjectResponse, T> transformer, SplittingTransformerConfiguration splitConfig) Splits the given transformer with a response mapper that appliestoFullObjectResponse(software.amazon.awssdk.services.s3.model.GetObjectResponse)to the first part's response before it reaches the customer's transformer.static GetObjectResponsetoFullObjectResponse(GetObjectResponse firstPartResponse) Rewrites a first-part response to represent the full object.
-
Method Details
-
completedParts
This method checks theS3MultipartExecutionAttribute.MULTIPART_DOWNLOAD_RESUME_CONTEXTexecution attributes for a context object and returns the complete parts associated with it, or an empty list of no context is found.- Parameters:
request-- Returns:
- The list of completed parts for a GetObjectRequest, or an empty list if none were found.
-
multipartDownloadResumeContext
public static Optional<MultipartDownloadResumeContext> multipartDownloadResumeContext(GetObjectRequest request) This method checks theS3MultipartExecutionAttribute.MULTIPART_DOWNLOAD_RESUME_CONTEXTexecution attributes for a context object and returns it if it finds one. Otherwise, returns an empty Optional.- Parameters:
request- the request to look for execution attributes- Returns:
- the MultipartDownloadResumeContext if one is found, otherwise an empty Optional.
-
multipartDownloadResumeContext
public static Optional<MultipartDownloadResumeContext> multipartDownloadResumeContext(S3Request request) This method checks theS3MultipartExecutionAttribute.MULTIPART_DOWNLOAD_RESUME_CONTEXTexecution attributes for a context object and returns it if it finds one. Otherwise, returns an empty Optional.- Parameters:
request- the request to look for execution attributes- Returns:
- the MultipartDownloadResumeContext if one is found, otherwise an empty Optional.
-
parseContentRange
Parses start byte and end byte from a Content-Range header.- Parameters:
contentRange- the Content-Range header value (e.g., "bytes 0-1023/2048")- Returns:
- array of [startByte, endByte], or null if parsing fails
-
parseContentRangeForTotalSize
-
calculateTotalParts
public static long calculateTotalParts(long contentLength, long partSize) Calculates the total number of parts needed to download an object of the given size.- Parameters:
contentLength- total object size in bytespartSize- size of each part in bytes- Returns:
- the number of parts
-
toFullObjectResponse
Rewrites a first-part response to represent the full object.- Parameters:
firstPartResponse- the GetObjectResponse from the first part request- Returns:
- full-object response with total content-length, full content-range, and checksum values nulled if checksum type is COMPOSITE
-
splitWithResponseRewrite
public static <T> AsyncResponseTransformer.SplitResult<GetObjectResponse,T> splitWithResponseRewrite(AsyncResponseTransformer<GetObjectResponse, T> transformer, SplittingTransformerConfiguration splitConfig) Splits the given transformer with a response mapper that appliestoFullObjectResponse(software.amazon.awssdk.services.s3.model.GetObjectResponse)to the first part's response before it reaches the customer's transformer.
-