Source:
public MultipleFileUpload uploadFileList(String bucketName, String virtualDirectoryKeyPrefix, File directory, List<File> files, ObjectMetadataProvider metadataProvider, ObjectTaggingProvider taggingProvider) { if ( directory == null || !directory.exists() || !directory.isDirectory() ) { throw new IllegalArgumentException("Must provide a common base directory for uploaded files"); } if (virtualDirectoryKeyPrefix == null || virtualDirectoryKeyPrefix.length() == 0) { virtualDirectoryKeyPrefix = ""; } else if ( !virtualDirectoryKeyPrefix.endsWith("/") ) { virtualDirectoryKeyPrefix = virtualDirectoryKeyPrefix + "/"; } ProgressListenerChain additionalListeners = new ProgressListenerChain(); TransferProgress progress = new TransferProgress(); ProgressListener listener = new MultipleFileTransferProgressUpdatingListener( progress, additionalListeners); List<UploadImpl> uploads = new LinkedList<UploadImpl>(); MultipleFileUploadImpl multipleFileUpload = new MultipleFileUploadImpl("Uploading etc", progress, additionalListeners, virtualDirectoryKeyPrefix, bucketName, uploads); multipleFileUpload.setMonitor(new MultipleFileTransferMonitor(multipleFileUpload, uploads)); final CountDownLatch latch = new CountDownLatch(1); MultipleFileTransferStateChangeListener transferListener = new MultipleFileTransferStateChangeListener(latch, multipleFileUpload); if (files == null || files.isEmpty()) { multipleFileUpload.setState(Transfer.TransferState.Completed); } else { int startingPosition = directory.getAbsolutePath().length(); if (!(directory.getAbsolutePath().endsWith(File.separator))) startingPosition++; long totalSize = 0; for (File f : files) { if (f.isFile()) { totalSize += f.length(); String key = f.getAbsolutePath() .substring(startingPosition) .replaceAll("\\\\", "/"); ObjectMetadata metadata = new ObjectMetadata(); ObjectTagging objectTagging = new ObjectTagging(new ArrayList<Tag>()); if (metadataProvider != null) { metadataProvider.provideObjectMetadata(f, metadata); } if(taggingProvider != null) { objectTagging = taggingProvider.provideObjectTags(f); } uploads.add((UploadImpl) doUpload( new PutObjectRequest(bucketName, virtualDirectoryKeyPrefix + key, f) .withMetadata(metadata) .withTagging(objectTagging) .<PutObjectRequest> withGeneralProgressListener( listener), transferListener, null, null)); } } progress.setTotalBytesToTransfer(totalSize); } latch.countDown(); return multipleFileUpload; }

Target:
public MultipleFileUpload uploadFileList(String bucketName, String virtualDirectoryKeyPrefix, File directory, List<File> files, ObjectMetadataProvider metadataProvider, ObjectTaggingProvider taggingProvider) { if ( directory == null || !directory.exists() || !directory.isDirectory() ) { throw new IllegalArgumentException("Must provide a common base directory for uploaded files"); } if (virtualDirectoryKeyPrefix == null || virtualDirectoryKeyPrefix.length() == 0) { virtualDirectoryKeyPrefix = ""; } else if ( !virtualDirectoryKeyPrefix.endsWith("/") ) { virtualDirectoryKeyPrefix = virtualDirectoryKeyPrefix + "/"; } ProgressListenerChain additionalListeners = new ProgressListenerChain(); TransferProgress progress = new TransferProgress(); ProgressListener listener = new MultipleFileTransferProgressUpdatingListener( progress, additionalListeners); List<UploadImpl> uploads = new LinkedList<UploadImpl>(); MultipleFileUploadImpl multipleFileUpload = new MultipleFileUploadImpl("Uploading etc", progress, additionalListeners, virtualDirectoryKeyPrefix, bucketName, uploads); multipleFileUpload.setMonitor(new MultipleFileTransferMonitor(multipleFileUpload, uploads)); final CountDownLatch latch = new CountDownLatch(1); MultipleFileTransferStateChangeListener transferListener = new MultipleFileTransferStateChangeListener(latch, multipleFileUpload); if (files == null || files.isEmpty()) { multipleFileUpload.setState(Transfer.TransferState.Completed); } else { int startingPosition = directory.getAbsolutePath().length(); if (!(directory.getAbsolutePath().endsWith(File.separator))) startingPosition++; long totalSize = 0; for (File f : files) { if (f.isFile()) { totalSize += f.length(); String key = f.getAbsolutePath() .substring(startingPosition) .replaceAll("\\\\", "/"); ObjectMetadata metadata = new ObjectMetadata(); ObjectTagging objectTagging = null; if (metadataProvider != null) { metadataProvider.provideObjectMetadata(f, metadata); } if(taggingProvider != null) { objectTagging = taggingProvider.provideObjectTags(f); } uploads.add((UploadImpl) doUpload( new PutObjectRequest(bucketName, virtualDirectoryKeyPrefix + key, f) .withMetadata(metadata) .withTagging(objectTagging) .<PutObjectRequest> withGeneralProgressListener( listener), transferListener, null, null)); } } progress.setTotalBytesToTransfer(totalSize); } latch.countDown(); return multipleFileUpload; }