/**
  * 删除文件
  *
  * @param fileName
  */
 @Override
 public void deleteFile(String fileName) {
   if (BAIDU_BCS == null) {
     BAIDU_BCS = new BaiduBCS(new BCSCredentials(AK, SK), HOST);
   }
   BAIDU_BCS.deleteObject(BUCKET, fileName);
 }
Ejemplo n.º 2
0
 private boolean deletePhoto(String path) {
   boolean flag = false;
   try {
     log.debug(
         "===========" + UserController.class.getName() + " :delete photo begin ===========");
     BCSCredentials credentials =
         new BCSCredentials(FinalVariable.BAE_USERNAME, FinalVariable.BAE_PASSWORD);
     BaiduBCS baiduBCS = new BaiduBCS(credentials, FinalVariable.BCSHOST);
     DeleteObjectRequest objectRequest = new DeleteObjectRequest(FinalVariable.BUCKET, path);
     baiduBCS.deleteObject(objectRequest);
     log.debug(
         "===========" + UserController.class.getName() + " :delete photo succeed ===========");
     flag = true;
   } catch (Exception e) {
     log.debug(
         "===========" + UserController.class.getName() + " :" + e.getMessage() + "===========");
     flag = false;
   }
   return flag;
 }