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


Java AmazonS3Client.getObject方法代码示例

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


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

示例1: setConf

import com.amazonaws.services.s3.AmazonS3Client; //导入方法依赖的package包/类
@Override
public void setConf(AbstractConfig config) {
  this.config = (GeoIpOperationConfig) config;
  AmazonS3Client client = this.s3Factory.newInstance();

  AmazonS3URI uri = new AmazonS3URI(this.config.getGeoLiteDb());
  GetObjectRequest req = new GetObjectRequest(uri.getBucket(), uri.getKey());
  S3Object obj = client.getObject(req);

  try {
    this.databaseReader =
        new DatabaseReader.Builder(obj.getObjectContent()).withCache(new CHMCache()).build();
  } catch (IOException e) {
    throw new ConfigurationException("Unable to read " + this.config.getGeoLiteDb(), e);
  }
}
 
开发者ID:Nextdoor,项目名称:bender,代码行数:17,代码来源:GeoIpOperationFactory.java

示例2: load

import com.amazonaws.services.s3.AmazonS3Client; //导入方法依赖的package包/类
public static BenderConfig load(AmazonS3ClientFactory s3ClientFactory, AmazonS3URI s3Uri) {
  AmazonS3Client s3 = s3ClientFactory.newInstance();
  S3Object s3object = s3.getObject(s3Uri.getBucket(), s3Uri.getKey());

  StringWriter writer = new StringWriter();

  try {
    IOUtils.copy(s3object.getObjectContent(), writer, "UTF-8");
  } catch (IOException e) {
    throw new ConfigurationException("Unable to read file from s3", e);
  }
  BenderConfig config = load(s3Uri.getKey().toString(), writer.toString());
  config.setConfigFile(s3Uri.getURI().toString());

  return config;
}
 
开发者ID:Nextdoor,项目名称:bender,代码行数:17,代码来源:BenderConfig.java

示例3: downloadSchema

import com.amazonaws.services.s3.AmazonS3Client; //导入方法依赖的package包/类
@Override
public String downloadSchema(BackupRestoreContext ctx) throws Exception {
    final String nodeId = ctx.getNodeId();
    final AmazonS3Client amazonS3Client = getAmazonS3Client(ctx);
    final String key = getPrefixKey(ctx) + "/" + nodeId + "/" + StorageUtil.SCHEMA_FILE;

    S3Object object = amazonS3Client.getObject(
            new GetObjectRequest(getBucketName(ctx), key));
    InputStream objectData = object.getObjectContent();
    String schema = IOUtils.toString(objectData, "UTF-8");
    objectData.close();
    return schema;
}
 
开发者ID:mesosphere,项目名称:dcos-cassandra-service,代码行数:14,代码来源:S3StorageDriver.java

示例4: getObject

import com.amazonaws.services.s3.AmazonS3Client; //导入方法依赖的package包/类
@Override
public S3Object getObject(String bucket, String key) throws Exception
{
    RefCountedClient holder = client.get();
    AmazonS3Client amazonS3Client = holder.useClient();
    try
    {
        return amazonS3Client.getObject(bucket, key);
    }
    finally
    {
        holder.release();
    }
}
 
开发者ID:dcos,项目名称:exhibitor,代码行数:15,代码来源:S3ClientImpl.java


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