Save This Page
Home » openjdk-7 » java » util » zip » [javadoc | source]
java.util.zip
public class: ZipOutputStream [javadoc | source]
java.lang.Object
   java.io.OutputStream
      java.io.FilterOutputStream
         java.util.zip.DeflaterOutputStream
            java.util.zip.ZipOutputStream

All Implemented Interfaces:
    ZipConstants, Flushable, Closeable

Direct Known Subclasses:
    JarOutputStream

This class implements an output stream filter for writing files in the ZIP file format. Includes support for both compressed and uncompressed entries.
Field Summary
public static final  int STORED    Compression method for uncompressed (STORED) entries. 
public static final  int DEFLATED    Compression method for compressed (DEFLATED) entries. 
Fields inherited from java.util.zip.DeflaterOutputStream:
def,  buf,  usesDefaultDeflater
Fields inherited from java.io.FilterOutputStream:
out
Constructor:
 public ZipOutputStream(OutputStream out) 
    Creates a new ZIP output stream.
    Parameters:
    out - the actual output stream
Method from java.util.zip.ZipOutputStream Summary:
close,   closeEntry,   finish,   getUTF8Length,   putNextEntry,   setComment,   setLevel,   setMethod,   write
Methods from java.util.zip.DeflaterOutputStream:
close,   deflate,   finish,   write,   write
Methods from java.io.FilterOutputStream:
close,   flush,   write,   write,   write
Methods from java.io.OutputStream:
close,   flush,   write,   write,   write
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from java.util.zip.ZipOutputStream Detail:
 public  void close() throws IOException 
    Closes the ZIP output stream as well as the stream being filtered.
 public  void closeEntry() throws IOException 
    Closes the current ZIP entry and positions the stream for writing the next entry.
 public  void finish() throws IOException 
    Finishes writing the contents of the ZIP output stream without closing the underlying stream. Use this method when applying multiple filters in succession to the same output stream.
 static int getUTF8Length(String s) 
 public  void putNextEntry(ZipEntry e) throws IOException 
    Begins writing a new ZIP file entry and positions the stream to the start of the entry data. Closes the current entry if still active. The default compression method will be used if no compression method was specified for the entry, and the current time will be used if the entry has no set modification time.
 public  void setComment(String comment) 
    Sets the ZIP file comment.
 public  void setLevel(int level) 
    Sets the compression level for subsequent entries which are DEFLATED. The default setting is DEFAULT_COMPRESSION.
 public  void setMethod(int method) 
    Sets the default compression method for subsequent entries. This default will be used whenever the compression method is not specified for an individual ZIP file entry, and is initially set to DEFLATED.
 public synchronized  void write(byte[] b,
    int off,
    int len) throws IOException 
    Writes an array of bytes to the current ZIP entry data. This method will block until all the bytes are written.