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


Java GetObjectRequest.getKey方法代码示例

本文整理汇总了Java中com.amazonaws.services.s3.model.GetObjectRequest.getKey方法的典型用法代码示例。如果您正苦于以下问题:Java GetObjectRequest.getKey方法的具体用法?Java GetObjectRequest.getKey怎么用?Java GetObjectRequest.getKey使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.amazonaws.services.s3.model.GetObjectRequest的用法示例。


在下文中一共展示了GetObjectRequest.getKey方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getObject

import com.amazonaws.services.s3.model.GetObjectRequest; //导入方法依赖的package包/类
@Override
public S3Object getObject(GetObjectRequest getObjectRequest)
        throws AmazonClientException, AmazonServiceException {
    // in ESBlobStoreContainerTestCase.java, the prefix is empty,
    // so the key and blobName are equivalent to each other
    String blobName = getObjectRequest.getKey();

    if (!blobs.containsKey(blobName)) {
        throw new AmazonS3Exception("[" + blobName + "] does not exist.");
    }

    // the HTTP request attribute is irrelevant for reading
    S3ObjectInputStream stream = new S3ObjectInputStream(
            blobs.get(blobName), null, false);
    S3Object s3Object = new S3Object();
    s3Object.setObjectContent(stream);
    return s3Object;
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:19,代码来源:MockAmazonS3.java

示例2: captureDownloadState

import com.amazonaws.services.s3.model.GetObjectRequest; //导入方法依赖的package包/类
/**
 * Returns the captured state of the download; or null if it should not be
 * captured (for security reason).
 */
private PersistableDownload captureDownloadState(
        final GetObjectRequest getObjectRequest, final File file) {
    if (getObjectRequest.getSSECustomerKey() == null) {
        return new PersistableDownload(
                getObjectRequest.getBucketName(), getObjectRequest.getKey(),
                getObjectRequest.getVersionId(), getObjectRequest.getRange(),
                getObjectRequest.getResponseHeaders(), getObjectRequest.isRequesterPays(),
                file.getAbsolutePath(), getLastFullyDownloadedPartNumber(),
                getObjectMetadata().getLastModified().getTime());
    }
    return null;
}
 
开发者ID:IBM,项目名称:ibm-cos-sdk-java,代码行数:17,代码来源:DownloadImpl.java


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