重粒子的运行轨迹

Compiling ...
baryon.cpp
baryon.cpp(1) : warning C0000: all glory is fleeing

导航

java批量将多文件打包成zip格式

public void createzip(){
		List<File> nFileList = new ArrayList<File>();
		nFileList.add(new File("C:\\Users\\Administrator\\Desktop\\测试移动到\\0001+国务院办公厅关于积极推进供应链创新与应用的指导意见.doc"));
		nFileList.add(new File("C:\\Users\\Administrator\\Desktop\\测试移动到\\0001+国务院办公厅关于积极推进供应链创新与应用的指导意见.pdf"));
		nFileList.add(new File("C:\\Users\\Administrator\\Desktop\\zenith.product.fms.main.js"));
		String strZipName = "C:\\Users\\Administrator\\Desktop\\lx.zip"; 
		FileInputStream nFileInputStream = null;
		ZipOutputStream nZipOutputStream = null;
		try {
			nZipOutputStream = new ZipOutputStream(new FileOutputStream(strZipName));
			for (File file : nFileList) {
				nFileInputStream = new FileInputStream(file);
				nZipOutputStream.putNextEntry(new ZipEntry(file.getName()));
				int len;
				while ((len = nFileInputStream.read()) != -1) {
					nZipOutputStream.write(len);
					nZipOutputStream.flush();
				}
			}
			nZipOutputStream.close();
			nFileInputStream.close();
			System.out.println("生成lx.zip成功");   
		} catch (FileNotFoundException e1) {
			e1.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

posted on 2018-03-28 13:42  重粒子  阅读(397)  评论(0编辑  收藏  举报