All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class java.util.zip.ZipOutputStream

java.lang.Object
   |
   +----java.io.OutputStream
           |
           +----java.io.FilterOutputStream
                   |
                   +----java.util.zip.DeflaterOutputStream
                           |
                           +----java.util.zip.ZipOutputStream

public class ZipOutputStream
extends DeflaterOutputStream
implements ZipConstants
This class implements an output stream filter for writing files in the ZIP file format. Includes support for both compressed and uncompressed entries.


Variable Index

 o DEFLATED
 o STORED
Compression methods.

Constructor Index

 o ZipOutputStream(OutputStream)
Creates a new ZIP output stream.

Method Index

 o close()
Closes the ZIP output stream.
 o closeEntry()
Closes the current ZIP entry.
 o putNextEntry(ZipEntry)
Skips to the next ZIP file entry for writing.
 o setComment(String)
Sets the ZIP file comment.
 o setLevel(int)
Sets the compression level for subsequent entries.
 o setMethod(int)
Sets the compression method for subsequent entries.
 o write(byte[], int, int)
Writes an array of bytes to the current ZIP entry.
 o write(int)
Writes specified byte to the current ZIP entry.

Variables

 o STORED
  public final static int STORED
Compression methods.

 o DEFLATED
  public final static int DEFLATED

Constructors

 o ZipOutputStream
  public ZipOutputStream(OutputStream out)
Creates a new ZIP output stream.

Methods

 o setComment
  public void setComment(String comment)
Sets the ZIP file comment.

Parameters:
comment - the comment string
 o setMethod
  public void setMethod(int method)
Sets the compression method for subsequent entries.

Parameters:
method - the new compression method to use
 o setLevel
  public void setLevel(int level)
Sets the compression level for subsequent entries.

Parameters:
level - the new compression level
 o putNextEntry
  public synchronized void putNextEntry(ZipEntry e) throws ZipException, IOException
Skips to the next ZIP file entry for writing.

Parameters:
e - the entry to be written
Throws: ZipException
if a ZIP error has occurred
Throws: IOException
if an I/O error has occurred
 o closeEntry
  public synchronized void closeEntry() throws ZipException, IOException
Closes the current ZIP entry.

 o write
  public synchronized void write(int b) throws ZipException, IOException
Writes specified byte to the current ZIP entry. This method will block until the byte is actually written.

Parameters:
b - the byte to be written
Throws: ZipException
if a ZIP error has occurred
Throws: IOException
if an I/O error has occurred
Overrides:
write in class DeflaterOutputStream
 o write
  public synchronized void write(byte buf[],
                                 int off,
                                 int len) throws ZipException, IOException
Writes an array of bytes to the current ZIP entry. This method will block until all the bytes are written.

Parameters:
buf - the bytes to be written
off - the start offset of the data
len - the length of the data
Throws: ZipException
if a ZIP error has occurred
Throws: IOException
if an I/O error has occurred
Overrides:
write in class DeflaterOutputStream
 o close
  public synchronized void close() throws ZipException, IOException
Closes the ZIP output stream.

Throws: ZipException
if a ZIP error has occurred
Throws: IOException
if an I/O error has occurred
Overrides:
close in class DeflaterOutputStream

All Packages  Class Hierarchy  This Package  Previous  Next  Index