Interface TransferProgressSnapshot
-
- All Known Implementing Classes:
DefaultTransferProgressSnapshot
@Immutable @ThreadSafe public interface TransferProgressSnapshot
TransferProgressSnapshot
is an immutable, point-in-time representation of the progress of a given transfer initiated byS3TransferManager
.TransferProgressSnapshot
offers several helpful methods for checking the progress of a transfer, liketransferredBytes()
andratioTransferred()
.TransferProgressSnapshot
's methods that returnOptional
are dependent upon the size of a transfer (i.e., theContent-Length
) being known. In the case of file-basedFileUpload
s, transfer sizes are known up front and immediately available. In the case ofDownload
s, the transfer size is not known untilS3TransferManager
receives aGetObjectResponse
from Amazon S3.The recommended way to receive updates of the latest
TransferProgressSnapshot
is to implement theTransferListener
interface. See theTransferListener
documentation for usage instructions. ATransferProgressSnapshot
can also be obtained from aTransferProgress
returned as part of the result from aTransferRequest
.- See Also:
TransferProgress
,TransferListener
,S3TransferManager
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description OptionalDouble
ratioTransferred()
The ratio of thetotalBytes()
that has been transferred so far, orOptional.empty()
if unknown.OptionalLong
remainingBytes()
The total number of bytes that are remaining to be transferred, orOptional.empty()
if unknown.Optional<SdkResponse>
sdkResponse()
The SDK response, orOptional.empty()
if unknown.OptionalLong
totalBytes()
The total size of the transfer, in bytes, orOptional.empty()
if unknown.long
transferredBytes()
The total number of bytes that have been transferred so far.
-
-
-
Method Detail
-
transferredBytes
long transferredBytes()
The total number of bytes that have been transferred so far.
-
totalBytes
OptionalLong totalBytes()
The total size of the transfer, in bytes, orOptional.empty()
if unknown.In the case of file-based
FileUpload
s, transfer sizes are known up front and immediately available. In the case ofDownload
s, the transfer size is not known untilS3TransferManager
receives aGetObjectResponse
from Amazon S3.
-
sdkResponse
Optional<SdkResponse> sdkResponse()
The SDK response, orOptional.empty()
if unknown.In the case of
Download
, the response isGetObjectResponse
, and the response is known before it starts streaming. In the case ofUpload
, the response isPutObjectResponse
, and the response is not known until streaming finishes.
-
ratioTransferred
OptionalDouble ratioTransferred()
The ratio of thetotalBytes()
that has been transferred so far, orOptional.empty()
if unknown. This method depends on thetotalBytes()
being known in order to return non-empty.Ratio is computed as
transferredBytes()
/
totalBytes()
, where a transfer that is half-complete would return0.5
.- See Also:
totalBytes()
-
remainingBytes
OptionalLong remainingBytes()
The total number of bytes that are remaining to be transferred, orOptional.empty()
if unknown. This method depends on thetotalBytes()
being known in order to return non-empty.- See Also:
totalBytes()
-
-