try {
FileOutputStream fos = new FileOutputStream("C:\\MyZip.zip");
ZipOutputStream zos = new ZipOutputStream(fos);
ZipEntry ze= new ZipEntry("C:\\file1.txt");
zos.putNextEntry(ze);
zos.closeEntry();
ze= new ZipEntry("C:\\file2.txt");
zos.putNextEntry(ze);
zos.closeEntry();
zos.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
Monday, 21 March 2011
Writing zip file in java
Labels:
java,
java.util.zip
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment