Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

zip file java


StringBuilder sb = new StringBuilder();
sb.append("Test String");

File f = new File("d:	est.zip");
ZipOutputStream out = new ZipOutputStream(new FileOutputStream(f));
ZipEntry e = new ZipEntry("mytext.txt");
out.putNextEntry(e);

byte[] data = sb.toString().getBytes();
out.write(data, 0, data.length);
out.closeEntry();

out.close();

Source by w3programmers.org #
 
PREVIOUS NEXT
Tagged: #zip #file #java
ADD COMMENT
Topic
Name
6+3 =