OSS Alibaba Cloud Custom Block Sketchware Pro

  • Version v1.1.1
  • Download 3
  • File Size 2 KB
  • File Count 1
  • Create Date 30/11/2020
  • Last Updated 30/11/2020

OSS Alibaba Cloud Custom Block Sketchware Pro

Object Storage Service (OSS) is a secure, cost-effective, and highly reliable cloud storage service provided by Alibaba Cloud. It enables you to store a large amount of data in the cloud. OSS is designed to provide 99.9999999999 (twelve 9s) durability and 99.995% availability of data over a given year.

OSS supports RESTful API operations that are independent of the console. You can store and access any type of data anytime, anywhere, and from any application.

You can use API operations and SDKs provided by Alibaba Cloud or OSS migration tools to transfer large amounts of data into or out of Alibaba Cloud OSS. You can use OSS buckets of the Standard storage class to store image, audio, and video files for apps and large websites. You can use OSS buckets of the Infrequent Access (IA), Archive storage class to store infrequently accessed objects at a low cost.

Alibaba Cloud OSS SDK for Java

Installation

<dependency>
   <groupId>com.aliyun</groupId>
   <artifactId>oss-baseclient</artifactId>
   <version>[1.1.0, 2.0.0)</version>
</dependency>
<dependency>
    <groupId>com.aliyun</groupId>
    <artifactId>oss-client</artifactId>
    <version>[1.1.0, 2.0.0)</version>
</dependency>

Demo

    Config config = new Config();
    // your accessKeyId
    config.accessKeyId = "";
    // your accessKeySecret
    config.accessKeySecret = "";
    // signature version 
    config.signatureVersion = "V2";
    Client client = new Client(config);
    
    // putObject
    PutObjectRequest request = new PutObjectRequest();
    request.bucketName = "sdk-oss-test";
    request.objectName = "sdk.txt";
    PutObjectRequest.PutObjectRequestHeader header = new PutObjectRequest.PutObjectRequestHeader();
    header.storageClass = "Archive";
    request.header = header;
    request.body = new ByteArrayInputStream("value".getBytes("UTF-8"));
    RuntimeObject runtimeObject = new RuntimeObject();
    PutObjectResponse response = client.putObject(request, runtimeObject);
    
    // getObject
    GetObjectRequest request = new GetObjectRequest();
    request.bucketName = "sdk-oss-test";
    request.objectName = "123.txt";
    RuntimeObject runtimeObject = new RuntimeObject();
    GetObjectResponse response = client.getObject(request, runtimeObject);
Comments are closed.