专注于Jsp开发,为Jsp开发提供源动力 VM主机| 海外空间| 郑州网站建设| 郑州网络公司| 洛阳网站建设
jsp空间

Java删除文件

添加时间:[2010-8-13 18:17:14] 

 private void deleteFiles(List<String> fileList, String path) {

  for (int index = 0; index < fileList.size(); index++) {

  String fullName = path + fileList.get(index);

  File file = new File(fullName);

  if (file.isFile() && file.exists()) {

  file.delete();

  }

  }

  }

  private void zipFile(List<String> fileList, String path, String zipFN) throws IOException {

  FileOutputStream fileOut = new FileOutputStream(path + zipFN);

  ZipOutputStream outputStream = new ZipOutputStream(fileOut);

  for (int index = 0; index < fileList.size(); index++) {

  String fileName = fileList.get(index);// "StockValuation.xls";

  String fullName = path + fileName;

  FileInputStream fileIn = new FileInputStream(fullName);

  ZipEntry entry = new ZipEntry(fileName);

  outputStream.putNextEntry(entry);

  byte[] buffer = new byte[1024];

  while (fileIn.read(buffer) != -1) {

  outputStream.write(buffer);

  }

  outputStream.closeEntry();

  fileIn.close();

  }

  outputStream.close();

  fileOut.close();

  }

关于我们 | 付款方式 | 客户管理 | 网站导航 | 友情连接


版权所有 2008 三易网络(洛阳)科技开发有限公司 京ICP备06012028号

服务热线:0371-63653120 63658758(郑州) 0379-63921200   63265368(洛阳)

QQ在线客服: JSP空间咨询   JSP空间咨询    Email:web@suneasy.cn

郑州网络公司 郑州网站建设 洛阳网站建设

总部地址:纱厂南路41号中泰新城泰福苑803室 郑州分公司地址:金水区圣菲城