Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Help Java Z Java ZipOutputStream

Related Tutorials


 
 

Share on Google+Share on Google+

Java ZipOutputStream

Advertisement
The java.util.zip package provides the class ZipOutputStream for writing ZIP files.

Java ZipOutputStream

     

 

The java.util.zip package provides the class ZipOutputStream for writing ZIP files. In order to compress data to a ZIP file, Java provides the ZipOutputStream class defined in the java.util.zip package. This class provides the functionality of writing the data in a compressed format. The constructor for this class accepts an OutputStream object. Basically, you can pass the output stream of the file you are writing to.


 
The following table shows the method summary of the ZipOutputStream class:

Method

Summary

close()

Closes the ZIP output stream as well as the stream being filtered.

closeEntry()  

Closes the current ZIP entry and positions the stream for writing the next entry.

finish()

Finishes writing the contents of the ZIP output stream without closing the underlying stream.

putNextEntry(ZipEntry e)

Begins writing a new ZIP file entry and positions the stream to the start of the entry data.

setComment(String comment)

Sets the ZIP file comment.

setLevel(int level)

Sets the compression level for subsequent entries, which are DEFLATED.

setMethod(int method)

Sets the default compression method for subsequent entries.

write(byte[] b, int off, int len)

Writes an array of bytes to the current ZIP entry data.

 


Read more at:

http:/www.roseindia.net/java/example/java/io/ZipCreateExample.shtml

Example: Java Zip

Read at :

http:/www.roseindia.net/java/example/java/io/

Advertisements

If you enjoyed this post then why not add us on Google+? Add us to your Circles



Liked it!  Share this Tutorial


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: June 16, 2009

Related Tutorials

Discuss: Java ZipOutputStream  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments:0
DMCA.com