Example usage for com.amazonaws.services.s3.transfer KeyFilter INCLUDE_ALL

List of usage examples for com.amazonaws.services.s3.transfer KeyFilter INCLUDE_ALL

Introduction

In this page you can find the example usage for com.amazonaws.services.s3.transfer KeyFilter INCLUDE_ALL.

Prototype

KeyFilter INCLUDE_ALL

To view the source code for com.amazonaws.services.s3.transfer KeyFilter INCLUDE_ALL.

Click Source Link

Document

Default filter that includes all keys.

Usage

From source file:org.apache.flink.streaming.tests.util.s3.S3UtilProgram.java

License:Apache License

private static void downloadByFullPathAndFileNamePrefix(ParameterTool params) {
    final String bucket = params.getRequired("bucket");
    final String s3prefix = params.getRequired("s3prefix");
    final String localFolder = params.getRequired("localFolder");
    final String s3filePrefix = params.get("s3filePrefix", "");
    TransferManager tx = TransferManagerBuilder.defaultTransferManager();
    Predicate<String> keyPredicate = getKeyFilterByFileNamePrefix(s3filePrefix);
    KeyFilter keyFilter = s3filePrefix.isEmpty() ? KeyFilter.INCLUDE_ALL
            : objectSummary -> keyPredicate.test(objectSummary.getKey());
    try {/*from  ww  w .  j a v  a  2 s  .c  o  m*/
        tx.downloadDirectory(bucket, s3prefix, new File(localFolder), keyFilter).waitForCompletion();
    } catch (InterruptedException e) {
        System.out.println("Transfer interrupted");
    } finally {
        tx.shutdownNow();
    }
}