当前位置: 首页>>代码示例>>Java>>正文


Java StorageObject.getMetadata方法代码示例

本文整理汇总了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;
}
 
开发者ID:guptavishal,项目名称:jets3t-aws-roles,代码行数:11,代码来源:RestStorageService.java

示例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);
    }
}
 
开发者ID:guptavishal,项目名称:jets3t-aws-roles,代码行数:65,代码来源:ObjectUtils.java


注:本文中的org.jets3t.service.model.StorageObject.getMetadata方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。