/*    */ package com.picc.grab.common;
/*    */ 
/*    */ import com.aliyun.oss.OSS;
/*    */ import com.aliyun.oss.OSSClient;
/*    */ import com.aliyun.oss.model.OSSObject;
/*    */ import com.aliyun.oss.model.PutObjectRequest;
/*    */ import java.io.InputStream;
/*    */ import org.slf4j.Logger;
/*    */ import org.slf4j.LoggerFactory;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ public class OSSMethod
/*    */ {
/* 16 */   private static final Logger logger = LoggerFactory.getLogger(OSSMethod.class);
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */   
/*    */   public static InputStream getObject(OSS ossClient, String bucketName, String key) {
/* 26 */     logger.info("OSSMethod getObject param key:" + key);
/* 27 */     InputStream is = null;
/*    */     try {
/* 29 */       if (ossClient.doesObjectExist(bucketName, key)) {
/*    */         
/* 31 */         OSSObject object = ossClient.getObject(bucketName, key);
/* 32 */         is = object.getObjectContent();
/*    */       } else {
/* 34 */         logger.info("OSSMethod getObject error object not exist:" + key);
/*    */       } 
/* 36 */     } catch (Exception e) {
/* 37 */       logger.info("OSSMethod getObject error: " + e.getMessage(), e);
/*    */     } 
/*    */     
/* 40 */     return is;
/*    */   }
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */   
/*    */   public static void putObject(OSS ossClient, String bucketName, String key, InputStream inputStream) {
/* 58 */     ossClient.putObject(new PutObjectRequest(bucketName, key, inputStream));
/*    */   }
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */   
/*    */   public static void deleteObject(OSSClient ossClient, String bucketName, String key) {
/* 69 */     ossClient.deleteObject(bucketName, key);
/*    */   }
/*    */ }


/* Location:              C:\Users\Administrator\Desktop\ROOT\WEB-INF\classes\!\com\picc\grab\common\OSSMethod.class
 * Java compiler version: 8 (52.0)
 * JD-Core Version:       1.1.3
 */