use of org.jets3t.service.utils.MultipartUtils in project hadoop by apache.
the class Jets3tNativeFileSystemStore method storeLargeFile.
public void storeLargeFile(String key, File file, byte[] md5Hash) throws IOException {
S3Object object = new S3Object(key);
object.setDataInputFile(file);
object.setContentType("binary/octet-stream");
object.setContentLength(file.length());
object.setServerSideEncryptionAlgorithm(serverSideEncryptionAlgorithm);
if (md5Hash != null) {
object.setMd5Hash(md5Hash);
}
List<StorageObject> objectsToUploadAsMultipart = new ArrayList<StorageObject>();
objectsToUploadAsMultipart.add(object);
MultipartUtils mpUtils = new MultipartUtils(multipartBlockSize);
try {
mpUtils.uploadObjects(bucket.getName(), s3Service, objectsToUploadAsMultipart, null);
} catch (Exception e) {
handleException(e, key);
}
}
Aggregations