use of com.amazonaws.services.s3.transfer.MultipleFileDownload in project aws-doc-sdk-examples by awsdocs.
the class XferMgrDownload method downloadDir.
public static void downloadDir(String bucket_name, String key_prefix, String dir_path, boolean pause) {
System.out.println("downloading to directory: " + dir_path + (pause ? " (pause)" : ""));
TransferManager xfer_mgr = new TransferManager();
try {
MultipleFileDownload xfer = xfer_mgr.downloadDirectory(bucket_name, key_prefix, new File(dir_path));
// loop with Transfer.isDone()
XferMgrProgress.showTransferProgress(xfer);
// or block with Transfer.waitForCompletion()
XferMgrProgress.waitForCompletion(xfer);
} catch (AmazonServiceException e) {
System.err.println(e.getErrorMessage());
System.exit(1);
}
xfer_mgr.shutdownNow();
}
Aggregations