本文整理汇总了Java中org.jets3t.service.model.StorageObject.getMetadata方法的典型用法代码示例。如果您正苦于以下问题:Java StorageObject.getMetadata方法的具体用法?Java StorageObject.getMetadata怎么用?Java StorageObject.getMetadata使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jets3t.service.model.StorageObject
的用法示例。
在下文中一共展示了StorageObject.getMetadata方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isLiveMD5HashingRequired
import org.jets3t.service.model.StorageObject; //导入方法依赖的package包/类
protected boolean isLiveMD5HashingRequired(StorageObject object){
// We do not need to calculate the data MD5 hash during upload if the
// expected hash value was provided as the object's Content-MD5 header.
if (object.getMetadata(StorageObject.METADATA_HEADER_CONTENT_MD5) != null) {
return false;
}
boolean disableLiveMd5 = jets3tProperties.getBoolProperty(
"storage-service.disable-live-md5", false);
return !disableLiveMd5;
}
示例2: createPackageForDownload
import org.jets3t.service.model.StorageObject; //导入方法依赖的package包/类
/**
* Creates a download package representing an S3Object that will be downloaded, and the
* target file the downloaded data will be written to.
* <p>
* Downloaded data may be transformed if the S3Object is encrypted or gzipped and the
* appropriate options are set.
*
* @param object
* the object
* @param fileTarget
* the file to which downloaded (and possibly transformed) data will be written.
* @param automaticUnzip
* if true, gzipped objects will be decrypted on-the-fly as they are downloaded.
* @param automaticDecrypt
* if true, encrypted files will be decrypted on-the-fly as they are downloaded (in which
* case the encryptionPassword must be correct)
* @param encryptionPassword
* the password required to decrypt encrypted objects.
*
* @return
* a download package representing an S3Object and a taret file for the object's data.
* @throws Exception
*/
public static DownloadPackage createPackageForDownload(StorageObject object, File fileTarget,
boolean automaticUnzip, boolean automaticDecrypt, String encryptionPassword) throws Exception
{
// Recognize directory place-holder objects and ignore them
if (object.isDirectoryPlaceholder()) {
return null;
}
else {
boolean isZipped = false;
EncryptionUtil encryptionUtil = null;
if (automaticUnzip &&
("gzip".equalsIgnoreCase(object.getContentEncoding())
|| object.containsMetadata(Constants.METADATA_JETS3T_COMPRESSED)))
{
// Object data is gzipped.
isZipped = true;
}
if (automaticDecrypt
&& object.containsMetadata(Constants.METADATA_JETS3T_CRYPTO_ALGORITHM))
{
// Object is encrypted.
if (encryptionPassword == null) {
throw new ServiceException(
"One or more objects are encrypted, and cannot be downloaded unless "
+ " the encyption password is provided");
}
String algorithm = (String) object.getMetadata(
Constants.METADATA_JETS3T_CRYPTO_ALGORITHM);
String version = (String) object.getMetadata(
Constants.METADATA_JETS3T_CRYPTO_VERSION);
if (version == null) {
version = EncryptionUtil.DEFAULT_VERSION;
}
encryptionUtil = new EncryptionUtil(encryptionPassword, algorithm, version);
}
return new DownloadPackage(object, fileTarget, isZipped, encryptionUtil);
}
}