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.
-
DEFLATED
-
-
STORED
- Compression methods.
-
ZipOutputStream(OutputStream)
- Creates a new ZIP output stream.
-
close()
- Closes the ZIP output stream.
-
closeEntry()
- Closes the current ZIP entry.
-
putNextEntry(ZipEntry)
- Skips to the next ZIP file entry for writing.
-
setComment(String)
- Sets the ZIP file comment.
-
setLevel(int)
- Sets the compression level for subsequent entries.
-
setMethod(int)
- Sets the compression method for subsequent entries.
-
write(byte[], int, int)
- Writes an array of bytes to the current ZIP entry.
-
write(int)
- Writes specified byte to the current ZIP entry.
STORED
public final static int STORED
- Compression methods.
DEFLATED
public final static int DEFLATED
ZipOutputStream
public ZipOutputStream(OutputStream out)
- Creates a new ZIP output stream.
setComment
public void setComment(String comment)
- Sets the ZIP file comment.
- Parameters:
- comment - the comment string
setMethod
public void setMethod(int method)
- Sets the compression method for subsequent entries.
- Parameters:
- method - the new compression method to use
setLevel
public void setLevel(int level)
- Sets the compression level for subsequent entries.
- Parameters:
- level - the new compression level
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
closeEntry
public synchronized void closeEntry() throws ZipException, IOException
- Closes the current ZIP entry.
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
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
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