代码如下:
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("结束了");
}
}