@Test public void testProcessSlices() { List<String> list = new ArrayList<>(); SliceConsumer recorder = (num, begin, end) -> { list.add(num + ":" + begin + "-" + end); }; list.clear(); S3Utils.processSlices(10, 25, recorder); assertEquals(Arrays.asList("0:0-10", "1:10-20", "2:20-25"), list); list.clear(); S3Utils.processSlices(10, 30, recorder); assertEquals(Arrays.asList("0:0-10", "1:10-20", "2:20-30"), list); list.clear(); S3Utils.processSlices(10, 10, recorder); assertEquals(Arrays.asList("0:0-10"), list); list.clear(); S3Utils.processSlices(10, 5, recorder); assertEquals(Arrays.asList("0:0-5"), list); list.clear(); S3Utils.processSlices(10, 0, recorder); assertEquals(Collections.emptyList(), list); }
public static void processSlices(long slice, long length, SliceConsumer consumer) { if (slice <= 0) { throw new IllegalArgumentException("Invalid slice length: " + slice); } long begin = 0; for (int num = 0; begin < length; num++) { long end = min(begin + slice, length); consumer.accept(num, begin, end); begin += slice; } }
S3Utils { public static void processSlices(long slice, long length, SliceConsumer consumer) { if (slice <= 0) { throw new IllegalArgumentException("Invalid slice length: " + slice); } long begin = 0; for (int num = 0; begin < length; num++) { long end = min(begin + slice, length); consumer.accept(num, begin, end); begin += slice; } } }
S3Utils { public static void processSlices(long slice, long length, SliceConsumer consumer) { if (slice <= 0) { throw new IllegalArgumentException("Invalid slice length: " + slice); } long begin = 0; for (int num = 0; begin < length; num++) { long end = min(begin + slice, length); consumer.accept(num, begin, end); begin += slice; } } private  S3Utils(); }
S3Utils { public static void processSlices(long slice, long length, SliceConsumer consumer) { if (slice <= 0) { throw new IllegalArgumentException("Invalid slice length: " + slice); } long begin = 0; for (int num = 0; begin < length; num++) { long end = min(begin + slice, length); consumer.accept(num, begin, end); begin += slice; } } private  S3Utils(); static void processSlices(long slice, long length, SliceConsumer consumer); @Deprecated static ObjectMetadata copyFile(AmazonS3 amazonS3, ObjectMetadata objectMetadata, String sourceBucket,
            String sourceKey, String targetBucket, String targetKey, String targetSSEAlgorithm, boolean deleteSource); @Deprecated static ObjectMetadata copyFileMultipart(AmazonS3 amazonS3, ObjectMetadata objectMetadata,
            String sourceBucket, String sourceKey, String targetBucket, String targetKey, boolean deleteSource); @Deprecated static ObjectMetadata copyFileMultipart(AmazonS3 amazonS3, ObjectMetadata objectMetadata,
            String sourceBucket, String sourceKey, String targetBucket, String targetKey, String targetSSEAlgorithm,
            boolean deleteSource); @Deprecated static ObjectMetadata copyFile(AmazonS3 amazonS3, ObjectMetadata objectMetadata, String sourceBucket,
            String sourceKey, String targetBucket, String targetKey, boolean deleteSource); @Deprecated static ObjectMetadata copyFileNonMultipart(AmazonS3 amazonS3, ObjectMetadata objectMetadata, String sourceBucket,
            String sourceKey, String targetBucket, String targetKey, String targetSSEAlgorithm, boolean deleteSource); static AWSCredentialsProvider getAWSCredentialsProvider(String accessKeyId, String secretKey,
            String sessionToken); }
S3Utils { public static void processSlices(long slice, long length, SliceConsumer consumer) { if (slice <= 0) { throw new IllegalArgumentException("Invalid slice length: " + slice); } long begin = 0; for (int num = 0; begin < length; num++) { long end = min(begin + slice, length); consumer.accept(num, begin, end); begin += slice; } } private  S3Utils(); static void processSlices(long slice, long length, SliceConsumer consumer); @Deprecated static ObjectMetadata copyFile(AmazonS3 amazonS3, ObjectMetadata objectMetadata, String sourceBucket,
            String sourceKey, String targetBucket, String targetKey, String targetSSEAlgorithm, boolean deleteSource); @Deprecated static ObjectMetadata copyFileMultipart(AmazonS3 amazonS3, ObjectMetadata objectMetadata,
            String sourceBucket, String sourceKey, String targetBucket, String targetKey, boolean deleteSource); @Deprecated static ObjectMetadata copyFileMultipart(AmazonS3 amazonS3, ObjectMetadata objectMetadata,
            String sourceBucket, String sourceKey, String targetBucket, String targetKey, String targetSSEAlgorithm,
            boolean deleteSource); @Deprecated static ObjectMetadata copyFile(AmazonS3 amazonS3, ObjectMetadata objectMetadata, String sourceBucket,
            String sourceKey, String targetBucket, String targetKey, boolean deleteSource); @Deprecated static ObjectMetadata copyFileNonMultipart(AmazonS3 amazonS3, ObjectMetadata objectMetadata, String sourceBucket,
            String sourceKey, String targetBucket, String targetKey, String targetSSEAlgorithm, boolean deleteSource); static AWSCredentialsProvider getAWSCredentialsProvider(String accessKeyId, String secretKey,
            String sessionToken); static final long NON_MULTIPART_COPY_MAX_SIZE; static final long MULTIPART_COPY_PART_SIZE_DEFAULT; @Deprecated
    static final long PART_SIZE; static final String MULTIPART_COPY_PART_SIZE_PROPERTY; }