當前位置: 首頁>>代碼示例>>Java>>正文


Java PutObjectResult.setContentMd5方法代碼示例

本文整理匯總了Java中com.amazonaws.services.s3.model.PutObjectResult.setContentMd5方法的典型用法代碼示例。如果您正苦於以下問題:Java PutObjectResult.setContentMd5方法的具體用法?Java PutObjectResult.setContentMd5怎麽用?Java PutObjectResult.setContentMd5使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.amazonaws.services.s3.model.PutObjectResult的用法示例。


在下文中一共展示了PutObjectResult.setContentMd5方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: putObject

import com.amazonaws.services.s3.model.PutObjectResult; //導入方法依賴的package包/類
@Override
public PutObjectResult putObject(PutObjectRequest putObjectRequest)
        throws AmazonClientException, AmazonServiceException {
    String blobName = putObjectRequest.getKey();
    DigestInputStream stream = (DigestInputStream) putObjectRequest.getInputStream();

    if (blobs.containsKey(blobName)) {
        throw new AmazonS3Exception("[" + blobName + "] already exists.");
    }

    blobs.put(blobName, stream);

    // input and output md5 hashes need to match to avoid an exception
    String md5 = Base64.encodeAsString(stream.getMessageDigest().digest());
    PutObjectResult result = new PutObjectResult();
    result.setContentMd5(md5);

    return result;
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:20,代碼來源:MockAmazonS3.java

示例2: putObject

import com.amazonaws.services.s3.model.PutObjectResult; //導入方法依賴的package包/類
@Override
public PutObjectResult putObject(String bucketName, String key, File file) throws AmazonClientException,
    AmazonServiceException {
  throwException(putObjectException);
  
  List<String> keys = files.get(bucketName);
  if (keys == null) {
    throw new AmazonClientException("Bucket do not exist");
  }
  keys.add(key);
  files.put(bucketName, keys);
  PutObjectResult result = new PutObjectResult();
  try {
    result.setContentMd5(new String(Md5Utils.md5AsBase64(file)));
  } catch (IOException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
  }
  return result;
}
 
開發者ID:DemandCube,項目名稱:Scribengin,代碼行數:21,代碼來源:AmazonS3Mock.java

示例3: buildPutObjectResult

import com.amazonaws.services.s3.model.PutObjectResult; //導入方法依賴的package包/類
private PutObjectResult buildPutObjectResult(FakeS3Object object) {
    PutObjectResult result = new PutObjectResult();
    result.setETag(object.getETag());
    result.setContentMd5(object.getMd5());
    return result;
}
 
開發者ID:OpenG,項目名稱:aws-java-sdk,代碼行數:7,代碼來源:FakeBucketsContainer.java


注:本文中的com.amazonaws.services.s3.model.PutObjectResult.setContentMd5方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。