本文整理匯總了Java中com.amazonaws.services.s3.model.ObjectMetadata.setSSEAlgorithm方法的典型用法代碼示例。如果您正苦於以下問題:Java ObjectMetadata.setSSEAlgorithm方法的具體用法?Java ObjectMetadata.setSSEAlgorithm怎麽用?Java ObjectMetadata.setSSEAlgorithm使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.amazonaws.services.s3.model.ObjectMetadata
的用法示例。
在下文中一共展示了ObjectMetadata.setSSEAlgorithm方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: move
import com.amazonaws.services.s3.model.ObjectMetadata; //導入方法依賴的package包/類
@Override
public void move(String sourceBlobName, String targetBlobName) throws IOException {
try {
CopyObjectRequest request = new CopyObjectRequest(blobStore.bucket(), buildKey(sourceBlobName),
blobStore.bucket(), buildKey(targetBlobName));
if (blobStore.serverSideEncryption()) {
ObjectMetadata objectMetadata = new ObjectMetadata();
objectMetadata.setSSEAlgorithm(ObjectMetadata.AES_256_SERVER_SIDE_ENCRYPTION);
request.setNewObjectMetadata(objectMetadata);
}
SocketAccess.doPrivilegedVoid(() -> {
blobStore.client().copyObject(request);
blobStore.client().deleteObject(blobStore.bucket(), buildKey(sourceBlobName));
});
} catch (AmazonS3Exception e) {
throw new IOException(e);
}
}
示例2: doInitialize
import com.amazonaws.services.s3.model.ObjectMetadata; //導入方法依賴的package包/類
protected String doInitialize(S3BlobStore blobStore, String bucketName, String blobName, boolean serverSideEncryption) {
InitiateMultipartUploadRequest request = new InitiateMultipartUploadRequest(bucketName, blobName)
.withCannedACL(blobStore.getCannedACL())
.withStorageClass(blobStore.getStorageClass());
if (serverSideEncryption) {
ObjectMetadata md = new ObjectMetadata();
md.setSSEAlgorithm(ObjectMetadata.AES_256_SERVER_SIDE_ENCRYPTION);
request.setObjectMetadata(md);
}
return blobStore.client().initiateMultipartUpload(request).getUploadId();
}
示例3: describeUpload
import com.amazonaws.services.s3.model.ObjectMetadata; //導入方法依賴的package包/類
private S3UploadDescriptor describeUpload(FileStatus sourceFileStatus, Path targetPath) throws IOException {
URI targetUri = targetPath.toUri();
String bucketName = PathUtil.toBucketName(targetUri);
String key = PathUtil.toBucketKey(targetUri);
Path sourcePath = sourceFileStatus.getPath();
ObjectMetadata metadata = new ObjectMetadata();
metadata.setContentLength(sourceFileStatus.getLen());
if (conf.getBoolean(ConfigurationVariable.S3_SERVER_SIDE_ENCRYPTION)) {
metadata.setSSEAlgorithm(ObjectMetadata.AES_256_SERVER_SIDE_ENCRYPTION);
}
return new S3UploadDescriptor(sourcePath, bucketName, key, metadata);
}