Java Code Examples for com.amazonaws.services.s3.transfer.Transfer#isDone()

The following examples show how to use com.amazonaws.services.s3.transfer.Transfer#isDone() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: XferMgrProgress.java    From dlp-dataflow-deidentification with Apache License 2.0 6 votes vote down vote up
public static void showTransferProgress(Transfer xfer) {
  // print the transfer's human-readable description
  System.out.println(xfer.getDescription());
  // print an empty progress bar...
  printProgressBar(0.0);
  // update the progress bar while the xfer is ongoing.
  do {
    try {
      Thread.sleep(100);
    } catch (InterruptedException e) {
      return;
    }
    // Note: so_far and total aren't used, they're just for
    // documentation purposes.
    TransferProgress progress = xfer.getProgress();
    long so_far = progress.getBytesTransferred();
    long total = progress.getTotalBytesToTransfer();
    double pct = progress.getPercentTransferred();
    eraseProgressBar();
    printProgressBar(pct);
  } while (xfer.isDone() == false);
  // print the final state of the transfer.
  TransferState xfer_state = xfer.getState();
  System.out.println(": " + xfer_state);
}