use of com.qcloud.cos.model.RestoreObjectRequest in project cos-java-sdk-v5 by tencentyun.
the class RestoreObjectTest method restoreObject.
@Test
public void restoreObject() {
InputStream input = new ByteArrayInputStream(new byte[10]);
ObjectMetadata objectMetadata = new ObjectMetadata();
objectMetadata.setContentLength(10);
String key = "ut/aaa.txt";
PutObjectRequest putObjectRequest = new PutObjectRequest(bucket, key, input, objectMetadata);
putObjectRequest.setStorageClass(StorageClass.Archive);
cosclient.putObject(putObjectRequest);
RestoreObjectRequest restoreObjectRequest = new RestoreObjectRequest(bucket, key, 1);
cosclient.restoreObject(restoreObjectRequest);
cosclient.deleteObject(bucket, key);
}
Aggregations