//package com.bonus.oss;
//
//import org.springframework.beans.factory.InitializingBean;
//import org.springframework.data.redis.core.convert.Bucket;
//import java.io.ByteArrayInputStream;
//import java.io.InputStream;
//import java.net.URL;
//import java.util.*;
//
//public class OssTemplate implements InitializingBean {
//   private final OssProperties ossProperties;
//   private AmazonS3 amazonS3;
//
//   public InputStream getObject(String bucketName, String objectName) {
//      try {
//         return this.amazonS3.getObject(bucketName, objectName).getObjectContent();
//      } catch (Throwable var4) {
//         throw var4;
//      }
//   }
//
//   public void removeObject(String bucketName, String objectName) throws Exception {
//      this.amazonS3.deleteObject(bucketName, objectName);
//   }
//
//   public void afterPropertiesSet() throws Exception {
//      ClientConfiguration clientConfiguration = new ClientConfiguration();
//      AwsClientBuilder.EndpointConfiguration endpointConfiguration = new AwsClientBuilder.EndpointConfiguration(this.ossProperties.getEndpoint(), this.ossProperties.getRegion());
//      AWSCredentials awsCredentials = new BasicAWSCredentials(this.ossProperties.getAccessKey(), this.ossProperties.getSecretKey());
//      AWSCredentialsProvider awsCredentialsProvider = new AWSStaticCredentialsProvider(awsCredentials);
//      if (this.ossProperties.getUseHttp()) {
//         System.setProperty("com.amazonaws.sdk.disableCertChecking", "true");
//      }
//
//      this.amazonS3 = (AmazonS3)((AmazonS3ClientBuilder)((AmazonS3ClientBuilder)((AmazonS3ClientBuilder)((AmazonS3ClientBuilder)((AmazonS3ClientBuilder)AmazonS3Client.builder().withEndpointConfiguration(endpointConfiguration)).withClientConfiguration(clientConfiguration)).withCredentials(awsCredentialsProvider)).disableChunkedEncoding()).withPathStyleAccessEnabled(this.ossProperties.getPathStyleAccess())).build();
//   }
//
//   public OssTemplate(final OssProperties ossProperties) {
//      this.ossProperties = ossProperties;
//   }
//
//}
