java 後臺刪除 七牛雲 數據

目的:java 後臺刪除 七牛雲 數據

代碼:

package com.xdx97.backstage;


import com.qiniu.common.Zone;
import com.qiniu.http.Response;
import com.qiniu.storage.BucketManager;
import com.qiniu.storage.Configuration;
import com.qiniu.util.Auth;

public class Test {

    public static void main(String[] args) {

        Auth auth = Auth.create("填寫你的AK", "填寫你的SK");
        Configuration config = new Configuration(Zone.autoZone());
        BucketManager bucketMgr = new BucketManager(auth, config);
        //指定需要刪除的文件,和文件所在的存儲空間
        String bucketName = "xxx";
        String  key = "xxx";
        try {
            Response delete = bucketMgr.delete(bucketName, key);
            delete.close();
        }catch (Exception e){
            e.printStackTrace();
        }
        System.out.println("結束了");
    }
}

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章