Search in sources :

Example 56 with COSClient

use of com.qcloud.cos.COSClient in project cos-java-sdk-v5 by tencentyun.

the class MediaInfoDemo method main.

public static void main(String[] args) {
    // 1 初始化用户身份信息(secretId, secretKey)。
    COSClient client = ClientUtils.getTestClient();
    // 2 调用要使用的方法。
    generateMediainfo(client);
}
Also used : COSClient(com.qcloud.cos.COSClient)

Example 57 with COSClient

use of com.qcloud.cos.COSClient in project cos-java-sdk-v5 by tencentyun.

the class QueueDemo method main.

public static void main(String[] args) {
    // 1 初始化用户身份信息(secretId, secretKey)。
    COSClient client = ClientUtils.getTestClient();
    // 2 调用要使用的方法。
    updateMediaQueue(client);
}
Also used : COSClient(com.qcloud.cos.COSClient)

Example 58 with COSClient

use of com.qcloud.cos.COSClient in project cos-java-sdk-v5 by tencentyun.

the class BucketDemo method main.

public static void main(String[] args) throws Exception {
    // 1 初始化用户身份信息(secretId, secretKey)。
    COSClient client = ClientUtils.getTestClient();
    // 2 调用要使用的方法。
    describeMediaBuckets(client);
}
Also used : COSClient(com.qcloud.cos.COSClient)

Example 59 with COSClient

use of com.qcloud.cos.COSClient in project cos-java-sdk-v5 by tencentyun.

the class ClientUtils method getCosClient.

public static COSClient getCosClient(String secretId, String secretKey, String _region) {
    // 1 初始化用户身份信息(secretId, secretKey)。
    COSCredentials cred = new BasicCOSCredentials(secretId, secretKey);
    // 2 设置 bucket 的区域, CI 地域的简称请参照 https://cloud.tencent.com/document/product/436/6224
    // clientConfig 中包含了设置 region, https(默认 https), 超时, 代理等 set 方法, 使用可参见源码或者常见问题 Java SDK 部分。
    Region region = new Region(_region);
    ClientConfig clientConfig = new ClientConfig(region);
    clientConfig.setHttpProtocol(HttpProtocol.http);
    // 3 生成 cos 客户端。
    return new COSClient(cred, clientConfig);
}
Also used : COSClient(com.qcloud.cos.COSClient) COSCredentials(com.qcloud.cos.auth.COSCredentials) BasicCOSCredentials(com.qcloud.cos.auth.BasicCOSCredentials) BasicCOSCredentials(com.qcloud.cos.auth.BasicCOSCredentials) Region(com.qcloud.cos.region.Region) ClientConfig(com.qcloud.cos.ClientConfig)

Example 60 with COSClient

use of com.qcloud.cos.COSClient in project cos-java-sdk-v5 by tencentyun.

the class ConcatDemo method main.

public static void main(String[] args) throws Exception {
    // 1 初始化用户身份信息(secretId, secretKey)。
    COSClient client = ClientUtils.getTestClient();
    // 2 调用要使用的方法。
    createMediaJobs(client);
}
Also used : COSClient(com.qcloud.cos.COSClient)

Aggregations

COSClient (com.qcloud.cos.COSClient)142 ClientConfig (com.qcloud.cos.ClientConfig)103 Region (com.qcloud.cos.region.Region)99 COSCredentials (com.qcloud.cos.auth.COSCredentials)96 BasicCOSCredentials (com.qcloud.cos.auth.BasicCOSCredentials)93 CosClientException (com.qcloud.cos.exception.CosClientException)38 CosServiceException (com.qcloud.cos.exception.CosServiceException)38 File (java.io.File)22 ObjectMetadata (com.qcloud.cos.model.ObjectMetadata)15 PutObjectResult (com.qcloud.cos.model.PutObjectResult)14 PutObjectRequest (com.qcloud.cos.model.PutObjectRequest)13 TransferManager (com.qcloud.cos.transfer.TransferManager)13 ExecutorService (java.util.concurrent.ExecutorService)13 AnonymousCOSCredentials (com.qcloud.cos.auth.AnonymousCOSCredentials)7 CopyObjectRequest (com.qcloud.cos.model.CopyObjectRequest)7 LinkedList (java.util.LinkedList)7 GetObjectRequest (com.qcloud.cos.model.GetObjectRequest)6 URL (java.net.URL)6 FileOperationException (run.halo.app.exception.FileOperationException)6 Date (java.util.Date)5