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


Java StorageObject.closeDataInputStream方法代码示例

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


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

示例1: retrieveMetadata

import org.jets3t.service.model.StorageObject; //导入方法依赖的package包/类
@Override
public FileMetadata retrieveMetadata(String key) throws IOException {
  StorageObject object = null;
  try {
    LOG.debug("Getting metadata for key: {} from bucket: {}",
        key, bucket.getName());
    object = s3Service.getObjectDetails(bucket.getName(), key);
    return new FileMetadata(key, object.getContentLength(),
        object.getLastModifiedDate().getTime());

  } catch (ServiceException e) {
    try {
      // process
      handleException(e, key);
      return null;
    } catch (FileNotFoundException fnfe) {
      // and downgrade missing files
      return null;
    }
  } finally {
    if (object != null) {
      object.closeDataInputStream();
    }
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:26,代码来源:Jets3tNativeFileSystemStore.java

示例2: retrieveMetadata

import org.jets3t.service.model.StorageObject; //导入方法依赖的package包/类
@Override
public FileMetadata retrieveMetadata(String key) throws IOException {
  StorageObject object = null;
  try {
    if(LOG.isDebugEnabled()) {
      LOG.debug("Getting metadata for key: " + key + " from bucket:" + bucket.getName());
    }
    object = s3Service.getObjectDetails(bucket.getName(), key);
    return new FileMetadata(key, object.getContentLength(),
        object.getLastModifiedDate().getTime());

  } catch (ServiceException e) {
    // Following is brittle. Is there a better way?
    if ("NoSuchKey".equals(e.getErrorCode())) {
      return null; //return null if key not found
    }
    handleServiceException(e);
    return null; //never returned - keep compiler happy
  } finally {
    if (object != null) {
      object.closeDataInputStream();
    }
  }
}
 
开发者ID:Seagate,项目名称:hadoop-on-lustre2,代码行数:25,代码来源:Jets3tNativeFileSystemStore.java

示例3: putObjectWithRequestEntityImpl

import org.jets3t.service.model.StorageObject; //导入方法依赖的package包/类
protected void putObjectWithRequestEntityImpl(String bucketName, StorageObject object,
    HttpEntity requestEntity, Map<String, String> requestParams) throws ServiceException
{

    Map<String, Object> map = createObjectImpl(bucketName, object.getKey(),
        object.getContentType(), requestEntity, object.getMetadataMap(),
        requestParams, object.getAcl(), object.getStorageClass(),
        object.getServerSideEncryptionAlgorithm());

    try {
        object.closeDataInputStream();
    } catch (IOException e) {
        if (log.isWarnEnabled()) {
            log.warn("Unable to close data input stream for object '" + object.getKey() + "'", e);
        }
    }

    // Populate object with result metadata.
    object.replaceAllMetadata(map);

    // Confirm that the data was not corrupted in transit by checking S3's calculated
    // hash value with the locally computed value. This is only necessary if the user
    // did not provide a Content-MD5 header with the original object.
    // Note that we can only confirm the data if we used a RepeatableRequestEntity to
    // upload it, if the user did not provide a content length with the original
    // object we are SOL.
    boolean md5Verify = isLiveMD5HashingRequired(object)
        && requestEntity instanceof RepeatableRequestEntity;
    if (log.isTraceEnabled()) {
        log.trace("Will " + (md5Verify ? "" : "NOT ")
                + "verify expected and actual e-tag values.");
    }
    if (md5Verify) {
        // Obtain locally-calculated MD5 hash from request entity.
        String hexMD5OfUploadedData = ServiceUtils.toHex(
            ((RepeatableRequestEntity)requestEntity).getMD5DigestOfData());
        verifyExpectedAndActualETagValues(hexMD5OfUploadedData, object);
    }
}
 
开发者ID:guptavishal,项目名称:jets3t-aws-roles,代码行数:40,代码来源:RestStorageService.java


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