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(); }
A java blog with a collection of examples and tutorials on Java and related technologies. (Under maintenance with continuous updates) Be in touch with java jazzle or k2java.blogspot.com.
Monday, March 21, 2011
Writing zip file in java
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment