Unless otherwise noted, passing a null
argument to a constructor
or method in this class will cause a NullPointerException
to be
thrown.
Modifier and Type | Class and Description |
---|---|
private static class |
Modifier and Type | Field and Description |
---|---|
private boolean | |
private byte[] | |
private CRC32 | |
private ZipOutputStream. | |
public static final int | DEFLATED
Compression method for compressed (DEFLATED) entries. |
private boolean | |
private static final boolean | inhibitZip64
Whether to use ZIP64 for ZIP files with more than 64k entries. |
private long | |
private int | |
private HashSet | |
public static final int | STORED
Compression method for uncompressed (STORED) entries. |
private long | |
private Vector | |
private final ZipCoder |
Access | Constructor and Description |
---|---|
public | |
public | ZipOutputStream(OutputStream
the actual output stream out, Charset the charset
to be used to encode the entry names and comments charset)Creates a new ZIP output stream. |
Modifier and Type | Method and Description |
---|---|
public void | close()
Overrides java. Implements java. Closes the ZIP output stream as well as the stream being filtered. |
public void | |
private void | |
public void | finish()
Overrides java. Finishes writing the contents of the ZIP output stream without closing the underlying stream. |
private int | |
public void | putNextEntry(ZipEntry
the ZIP entry to be written e)Begins writing a new ZIP file entry and positions the stream to the start of the entry data. |
public void | |
public void | setLevel(int
the compression level (0-9) level)Sets the compression level for subsequent entries which are DEFLATED. |
public void | setMethod(int
the default compression method method)Sets the default compression method for subsequent entries. |
private static int | |
private int | versionMadeBy(ZipEntry e, int version)
Adds information about compatibility of file attribute information to a version value. |
public synchronized void | write(byte[]
the data to be written b, int the start offset in the data off, int the number of bytes that are written len)Overrides java. Writes an array of bytes to the current ZIP entry data. |
private void | |
private void | |
private void | |
private void | |
private void | |
private void | |
private void | |
private void | |
private void | |
private void |
closed | back to summary |
---|---|
private boolean closed |
comment | back to summary |
---|---|
private byte[] comment |
crc | back to summary |
---|---|
private CRC32 crc |
current | back to summary |
---|---|
private ZipOutputStream. |
DEFLATED | back to summary |
---|---|
public static final int DEFLATED Compression method for compressed (DEFLATED) entries. |
finished | back to summary |
---|---|
private boolean finished |
inhibitZip64 | back to summary |
---|---|
private static final boolean inhibitZip64 Whether to use ZIP64 for ZIP files with more than 64k entries. Until ZIP64 support in ZIP implementations is ubiquitous, this system property allows the creation of ZIP files which can be read by legacy ZIP implementations which tolerate "incorrect" total entry count fields, such as the ones in jdk6, and even some in jdk7. |
locoff | back to summary |
---|---|
private long locoff |
method | back to summary |
---|---|
private int method |
names | back to summary |
---|---|
private HashSet<String> names |
STORED | back to summary |
---|---|
public static final int STORED Compression method for uncompressed (STORED) entries. |
written | back to summary |
---|---|
private long written |
xentries | back to summary |
---|---|
private Vector<ZipOutputStream. |
zc | back to summary |
---|---|
private final ZipCoder zc |
ZipOutputStream | back to summary |
---|---|
public ZipOutputStream(OutputStream out) Creates a new ZIP output stream. The UTF-8
|
ZipOutputStream | back to summary |
---|---|
public ZipOutputStream(OutputStream out, Charset charset) Creates a new ZIP output stream.
|
close | back to summary |
---|---|
public void close() throws IOException Overrides java. Implements java. Closes the ZIP output stream as well as the stream being filtered.
|
closeEntry | back to summary |
---|---|
public void closeEntry() throws IOException Closes the current ZIP entry and positions the stream for writing the next entry.
|
ensureOpen | back to summary |
---|---|
private void ensureOpen() throws IOException Checks to make sure that this stream has not been closed. |
finish | back to summary |
---|---|
public void finish() throws IOException Overrides java. 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.
|
getExtraLen | back to summary |
---|---|
private int getExtraLen(byte[] extra) |
putNextEntry | back to summary |
---|---|
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. When writing a compressed (DEFLATED)
entry, and the compressed size has not been explicitly set with the
The current time will be used if the entry has no set modification time. API Note When writing a directory entry, the STORED compression method should be used and the size and CRC-32 values should be set to 0: ZipEntry e = new ZipEntry(entryName); if (e.isDirectory()) { e.setMethod(ZipEntry.STORED); e.setSize(0); e.setCrc(0); } stream.putNextEntry(e);
|
setComment | back to summary |
---|---|
public void setComment(String comment) Sets the ZIP file comment.
|
setLevel | back to summary |
---|---|
public void setLevel(int level) Sets the compression level for subsequent entries which are DEFLATED. The default setting is DEFAULT_COMPRESSION.
|
setMethod | back to summary |
---|---|
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.
|
version | back to summary |
---|---|
private static int version(ZipEntry e) throws ZipException |
versionMadeBy | back to summary |
---|---|
private int versionMadeBy(ZipEntry e, int version) Adds information about compatibility of file attribute information to a version value. |
write | back to summary |
---|---|
public synchronized void write(byte[] b, int off, int len) throws IOException Overrides java. Writes an array of bytes to the current ZIP entry data. This method will block until all the bytes are written.
|
writeByte | back to summary |
---|---|
private void writeByte(int v) throws IOException |
writeBytes | back to summary |
---|---|
private void writeBytes(byte[] b, int off, int len) throws IOException |
writeCEN | back to summary |
---|---|
private void writeCEN(ZipOutputStream. |
writeEND | back to summary |
---|---|
private void writeEND(long off, long len) throws IOException |
writeEXT | back to summary |
---|---|
private void writeEXT(ZipEntry e) throws IOException |
writeExtra | back to summary |
---|---|
private void writeExtra(byte[] extra) throws IOException |
writeInt | back to summary |
---|---|
private void writeInt(long v) throws IOException |
writeLOC | back to summary |
---|---|
private void writeLOC(ZipOutputStream. |
writeLong | back to summary |
---|---|
private void writeLong(long v) throws IOException |
writeShort | back to summary |
---|---|
private void writeShort(int v) throws IOException |
Modifier and Type | Field and Description |
---|---|
pack-priv final ZipEntry | |
pack-priv final long |
entry | back to summary |
---|---|
pack-priv final ZipEntry entry |
offset | back to summary |
---|---|
pack-priv final long offset |
XEntry | back to summary |
---|---|
public XEntry(ZipEntry entry, long offset) |