@Immutable @ThreadSafe public interface TransferProgressSnapshot
TransferProgressSnapshot is an immutable, point-in-time representation of the progress of a given transfer
initiated by S3TransferManager. TransferProgressSnapshot offers several helpful methods for checking the
progress of a transfer, like transferredBytes() and ratioTransferred().
TransferProgressSnapshot's methods that return Optional are dependent upon the size of a transfer (i.e., the
Content-Length) being known. In the case of file-based FileUploads, transfer sizes are known up front and
immediately available. In the case of Downloads, the transfer size is not known until S3TransferManager
receives a GetObjectResponse from Amazon S3.
The recommended way to receive updates of the latest TransferProgressSnapshot is to implement the TransferListener interface. See the TransferListener documentation for usage instructions. A TransferProgressSnapshot can also be obtained from a TransferProgress returned as part of the result from a TransferRequest.
TransferProgress,
TransferListener,
S3TransferManager| Modifier and Type | Method and Description |
|---|---|
OptionalDouble |
ratioTransferred()
The ratio of the
totalBytes() that has been transferred so far, or Optional.empty() if unknown. |
OptionalLong |
remainingBytes()
The total number of bytes that are remaining to be transferred, or
Optional.empty() if unknown. |
Optional<SdkResponse> |
sdkResponse()
The SDK response, or
Optional.empty() if unknown. |
OptionalLong |
totalBytes()
The total size of the transfer, in bytes, or
Optional.empty() if unknown. |
long |
transferredBytes()
The total number of bytes that have been transferred so far.
|
long transferredBytes()
OptionalLong totalBytes()
Optional.empty() if unknown.
In the case of file-based FileUploads, transfer sizes are known up front and immediately available. In the case of
Downloads, the transfer size is not known until S3TransferManager receives a GetObjectResponse from
Amazon S3.
Optional<SdkResponse> sdkResponse()
Optional.empty() if unknown.
In the case of Download, the response is GetObjectResponse, and the response is known before
it starts streaming. In the case of Upload, the response is PutObjectResponse, and the response is not
known until streaming finishes.
OptionalDouble ratioTransferred()
totalBytes() that has been transferred so far, or Optional.empty() if unknown.
This method depends on the totalBytes() being known in order to return non-empty.
Ratio is computed as transferredBytes() / totalBytes(), where a transfer that is
half-complete would return 0.5.
totalBytes()OptionalLong remainingBytes()
Optional.empty() if unknown. This method depends
on the totalBytes() being known in order to return non-empty.totalBytes()Copyright © 2023. All rights reserved.