本文整理汇总了Java中org.jets3t.service.utils.MultipartUtils.uploadObjects方法的典型用法代码示例。如果您正苦于以下问题:Java MultipartUtils.uploadObjects方法的具体用法?Java MultipartUtils.uploadObjects怎么用?Java MultipartUtils.uploadObjects使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jets3t.service.utils.MultipartUtils
的用法示例。
在下文中一共展示了MultipartUtils.uploadObjects方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: storeLargeFile
import org.jets3t.service.utils.MultipartUtils; //导入方法依赖的package包/类
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);
}
}
示例2: uploadObjectsAsMultiparts
import org.jets3t.service.utils.MultipartUtils; //导入方法依赖的package包/类
@Override
public void uploadObjectsAsMultiparts(final String bucketName, final List<StorageObject> objects)
throws ServiceException, Exception {
LOGGER.info("putObjectsAsMultiparts invoked, bucketName: {}", bucketName);
final MultipartUtils multipartUtils = new MultipartUtils();
multipartUtils.uploadObjects(bucketName, s3Service, objects, null);
}
示例3: uploadDirectoryAsMultiparts
import org.jets3t.service.utils.MultipartUtils; //导入方法依赖的package包/类
@Override
public void uploadDirectoryAsMultiparts(final String bucketName, final File dirPath)
throws ServiceException, Exception {
LOGGER.info("uploadDirectoryAsMultiparts invoked, bucketName: {} and dirPath: {}", bucketName, dirPath);
final Set<File> setOfFilePath = DirectoryTraverser.getFileUris(dirPath);
final List<StorageObject> objects = new ArrayList<StorageObject>();
for (final File file : setOfFilePath) {
objects.add(ObjectUtils.createObjectForUpload(file.getName(), file, null, // encryptionUtil
false // gzipFile
));
}
final MultipartUtils multipartUtils = new MultipartUtils();
multipartUtils.uploadObjects(bucketName, s3Service, objects, null);
}
示例4: multipartUpload
import org.jets3t.service.utils.MultipartUtils; //导入方法依赖的package包/类
private void multipartUpload(S3Object object) throws Exception {
List<StorageObject> objectsToUploadAsMultipart = Arrays.<StorageObject>asList(object);
MultipartUtils mpUtils = new MultipartUtils(configuration.getUploadPartSize());
mpUtils.uploadObjects(s3Bucket.getName(), s3Service, objectsToUploadAsMultipart, null);
}