Interface TransferProgress
- All Known Implementing Classes:
DefaultTransferProgress
,ResumeTransferProgress
TransferProgress
is a stateful representation of the progress of a transfer initiated by S3TransferManager
. TransferProgress
offers the ability to take a snapshot()
of the current progress,
represented by an immutable TransferProgressSnapshot
, which contains helpful progress-related methods like TransferProgressSnapshot.transferredBytes()
and TransferProgressSnapshot.ratioTransferred()
. TransferProgress
is attached to ObjectTransfer
objects, namely Upload
, Download
, and Copy
.
Where possible, it is typically recommended to avoid directly querying TransferProgress
and to instead leverage
the TransferListener
interface to receive event-driven updates of the latest TransferProgressSnapshot
. See the
TransferListener
documentation for usage instructions. However, if desired, TransferProgress
can be used for
poll-like checking of the current progress. E.g.,
Upload upload = tm.upload(...);
while (!upload.completionFuture().isDone()) {
upload.progress().snapshot().ratioTransferred().ifPresent(System.out::println);
Thread.sleep(1000);
}
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionsnapshot()
Takes a snapshot of the current progress, represented by an immutableTransferProgressSnapshot
.
-
Method Details
-
snapshot
TransferProgressSnapshot snapshot()Takes a snapshot of the current progress, represented by an immutableTransferProgressSnapshot
.
-