# ZipOutputStream

public class **ZipOutputStream** extends [DeflaterOutputStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/zip/DeflaterOutputStream.html)  

|---|---|---|
| Known Direct Subclasses [JarOutputStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/jar/JarOutputStream.html) |---|---| | [JarOutputStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/jar/JarOutputStream.html) | The `JarOutputStream` class is used to write the contents of a JAR file to any output stream. | |||

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

### Constant Summary

|---|---|---|
| int | [CENATT](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/zip/ZipOutputStream.html#CENATT) |   |
| int | [CENATX](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/zip/ZipOutputStream.html#CENATX) |   |
| int | [CENCOM](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/zip/ZipOutputStream.html#CENCOM) |   |
| int | [CENCRC](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/zip/ZipOutputStream.html#CENCRC) |   |
| int | [CENDSK](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/zip/ZipOutputStream.html#CENDSK) |   |
| int | [CENEXT](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/zip/ZipOutputStream.html#CENEXT) |   |
| int | [CENFLG](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/zip/ZipOutputStream.html#CENFLG) |   |
| int | [CENHDR](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/zip/ZipOutputStream.html#CENHDR) |   |
| int | [CENHOW](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/zip/ZipOutputStream.html#CENHOW) |   |
| int | [CENLEN](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/zip/ZipOutputStream.html#CENLEN) |   |
| int | [CENNAM](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/zip/ZipOutputStream.html#CENNAM) |   |
| int | [CENOFF](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/zip/ZipOutputStream.html#CENOFF) |   |
| long | [CENSIG](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/zip/ZipOutputStream.html#CENSIG) |   |
| int | [CENSIZ](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/zip/ZipOutputStream.html#CENSIZ) |   |
| int | [CENTIM](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/zip/ZipOutputStream.html#CENTIM) |   |
| int | [CENVEM](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/zip/ZipOutputStream.html#CENVEM) |   |
| int | [CENVER](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/zip/ZipOutputStream.html#CENVER) |   |
| int | [DEFLATED](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/zip/ZipOutputStream.html#DEFLATED) | Compression method for compressed (DEFLATED) entries. |
| int | [ENDCOM](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/zip/ZipOutputStream.html#ENDCOM) |   |
| int | [ENDHDR](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/zip/ZipOutputStream.html#ENDHDR) |   |
| int | [ENDOFF](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/zip/ZipOutputStream.html#ENDOFF) |   |
| long | [ENDSIG](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/zip/ZipOutputStream.html#ENDSIG) |   |
| int | [ENDSIZ](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/zip/ZipOutputStream.html#ENDSIZ) |   |
| int | [ENDSUB](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/zip/ZipOutputStream.html#ENDSUB) |   |
| int | [ENDTOT](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/zip/ZipOutputStream.html#ENDTOT) |   |
| int | [EXTCRC](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/zip/ZipOutputStream.html#EXTCRC) |   |
| int | [EXTHDR](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/zip/ZipOutputStream.html#EXTHDR) |   |
| int | [EXTLEN](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/zip/ZipOutputStream.html#EXTLEN) |   |
| long | [EXTSIG](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/zip/ZipOutputStream.html#EXTSIG) |   |
| int | [EXTSIZ](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/zip/ZipOutputStream.html#EXTSIZ) |   |
| int | [LOCCRC](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/zip/ZipOutputStream.html#LOCCRC) |   |
| int | [LOCEXT](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/zip/ZipOutputStream.html#LOCEXT) |   |
| int | [LOCFLG](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/zip/ZipOutputStream.html#LOCFLG) |   |
| int | [LOCHDR](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/zip/ZipOutputStream.html#LOCHDR) |   |
| int | [LOCHOW](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/zip/ZipOutputStream.html#LOCHOW) |   |
| int | [LOCLEN](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/zip/ZipOutputStream.html#LOCLEN) |   |
| int | [LOCNAM](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/zip/ZipOutputStream.html#LOCNAM) |   |
| long | [LOCSIG](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/zip/ZipOutputStream.html#LOCSIG) |   |
| int | [LOCSIZ](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/zip/ZipOutputStream.html#LOCSIZ) |   |
| int | [LOCTIM](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/zip/ZipOutputStream.html#LOCTIM) |   |
| int | [LOCVER](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/zip/ZipOutputStream.html#LOCVER) |   |
| int | [STORED](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/zip/ZipOutputStream.html#STORED) | Compression method for uncompressed (STORED) entries. |

### Inherited Field Summary

From class [java.util.zip.DeflaterOutputStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/zip/DeflaterOutputStream.html)

|---|---|---|
| protected byte\[\] | [buf](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/zip/DeflaterOutputStream.html#buf) | Output buffer for writing compressed data. |
| protected [Deflater](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/zip/Deflater.html) | [def](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/zip/DeflaterOutputStream.html#def) | Compressor for this stream. |

From class [java.io.FilterOutputStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/FilterOutputStream.html)

|---|---|---|
| protected [OutputStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/OutputStream.html) | [out](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/FilterOutputStream.html#out) | The underlying output stream to be filtered. |

### Public Constructor Summary

|---|---|
|   | [ZipOutputStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/zip/ZipOutputStream.html#ZipOutputStream(java.io.OutputStream))([OutputStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/OutputStream.html) out) Creates a new ZIP output stream. |
|   | [ZipOutputStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/zip/ZipOutputStream.html#ZipOutputStream(java.io.OutputStream,%20java.nio.charset.Charset))([OutputStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/OutputStream.html) out, [Charset](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/charset/Charset.html) charset) Creates a new ZIP output stream. |

### Public Method Summary

|---|---|
| void | [close](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/zip/ZipOutputStream.html#close())() Closes the ZIP output stream as well as the stream being filtered. |
| void | [closeEntry](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/zip/ZipOutputStream.html#closeEntry())() Closes the current ZIP entry and positions the stream for writing the next entry. |
| void | [finish](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/zip/ZipOutputStream.html#finish())() Finishes writing the contents of the ZIP output stream without closing the underlying stream. |
| void | [putNextEntry](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/zip/ZipOutputStream.html#putNextEntry(java.util.zip.ZipEntry))([ZipEntry](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/zip/ZipEntry.html) e) Begins writing a new ZIP file entry and positions the stream to the start of the entry data. |
| void | [setComment](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/zip/ZipOutputStream.html#setComment(java.lang.String))([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) comment) Sets the ZIP file comment. |
| void | [setLevel](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/zip/ZipOutputStream.html#setLevel(int))(int level) Sets the compression level for subsequent entries which are DEFLATED. |
| void | [setMethod](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/zip/ZipOutputStream.html#setMethod(int))(int method) Sets the default compression method for subsequent entries. |
| synchronized void | [write](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/zip/ZipOutputStream.html#write(byte[],%20int,%20int))(byte\[\] b, int off, int len) Writes an array of bytes to the current ZIP entry data. |

### Inherited Method Summary

From class [java.util.zip.DeflaterOutputStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/zip/DeflaterOutputStream.html)

|---|---|
| void | [close](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/zip/DeflaterOutputStream.html#close())() Writes remaining compressed data to the output stream and closes the underlying stream. |
| void | [deflate](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/zip/DeflaterOutputStream.html#deflate())() Writes next block of compressed data to the output stream. |
| void | [finish](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/zip/DeflaterOutputStream.html#finish())() Finishes writing compressed data to the output stream without closing the underlying stream. |
| void | [flush](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/zip/DeflaterOutputStream.html#flush())() Flushes the compressed output stream. |
| void | [write](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/zip/DeflaterOutputStream.html#write(byte[],%20int,%20int))(byte\[\] b, int off, int len) Writes an array of bytes to the compressed output stream. |
| void | [write](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/zip/DeflaterOutputStream.html#write(int))(int b) Writes a byte to the compressed output stream. |

From class [java.io.FilterOutputStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/FilterOutputStream.html)

|---|---|
| void | [close](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/FilterOutputStream.html#close())() Closes this output stream and releases any system resources associated with the stream. |
| void | [flush](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/FilterOutputStream.html#flush())() Flushes this output stream and forces any buffered output bytes to be written out to the stream. |
| void | [write](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/FilterOutputStream.html#write(byte[]))(byte\[\] b) Writes `b.length` bytes to this output stream. |
| void | [write](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/FilterOutputStream.html#write(byte[],%20int,%20int))(byte\[\] b, int off, int len) Writes `len` bytes from the specified `byte` array starting at offset `off` to this output stream. |
| void | [write](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/FilterOutputStream.html#write(int))(int b) Writes the specified `byte` to this output stream. |

From class [java.io.OutputStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/OutputStream.html)

|---|---|
| void | [close](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/OutputStream.html#close())() Closes this output stream and releases any system resources associated with this stream. |
| void | [flush](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/OutputStream.html#flush())() Flushes this output stream and forces any buffered output bytes to be written out. |
| void | [write](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/OutputStream.html#write(byte[]))(byte\[\] b) Writes `b.length` bytes from the specified byte array to this output stream. |
| void | [write](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/OutputStream.html#write(byte[],%20int,%20int))(byte\[\] b, int off, int len) Writes `len` bytes from the specified byte array starting at offset `off` to this output stream. |
| abstract void | [write](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/OutputStream.html#write(int))(int b) Writes the specified byte to this output stream. |

From class [java.lang.Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html)

|---|---|
| [Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) | [clone](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#clone())() Creates and returns a copy of this `Object`. |
| boolean | [equals](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#equals(java.lang.Object))([Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) obj) Compares this instance with the specified object and indicates if they are equal. |
| void | [finalize](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#finalize())() Invoked when the garbage collector has detected that this instance is no longer reachable. |
| final [Class](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Class.html)\<?\> | [getClass](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#getClass())() Returns the unique instance of `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Class.html` that represents this object's class. |
| int | [hashCode](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#hashCode())() Returns an integer hash code for this object. |
| final void | [notify](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#notify())() Causes a thread which is waiting on this object's monitor (by means of calling one of the `wait()` methods) to be woken up. |
| final void | [notifyAll](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#notifyAll())() Causes all threads which are waiting on this object's monitor (by means of calling one of the `wait()` methods) to be woken up. |
| [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [toString](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#toString())() Returns a string containing a concise, human-readable description of this object. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait(long,%20int))(long timeout, int nanos) Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object or until the specified timeout expires. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait(long))(long timeout) Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object or until the specified timeout expires. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait())() Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object. |

From interface [java.io.Closeable](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/Closeable.html)

|---|---|
| abstract void | [close](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/Closeable.html#close())() Closes this stream and releases any system resources associated with it. |

From interface [java.io.Flushable](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/Flushable.html)

|---|---|
| abstract void | [flush](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/Flushable.html#flush())() Flushes this stream by writing any buffered output to the underlying stream. |

From interface [java.lang.AutoCloseable](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/AutoCloseable.html)

|---|---|
| abstract void | [close](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/AutoCloseable.html#close())() Closes this resource, relinquishing any underlying resources. |

## Constants

#### public static final int
**CENATT**

<br />

Constant Value: 36

#### public static final int
**CENATX**

<br />

Constant Value: 38

#### public static final int
**CENCOM**

<br />

Constant Value: 32

#### public static final int
**CENCRC**

<br />

Constant Value: 16

#### public static final int
**CENDSK**

<br />

Constant Value: 34

#### public static final int
**CENEXT**

<br />

Constant Value: 30

#### public static final int
**CENFLG**

<br />

Constant Value: 8

#### public static final int
**CENHDR**

<br />

Constant Value: 46

#### public static final int
**CENHOW**

<br />

Constant Value: 10

#### public static final int
**CENLEN**

<br />

Constant Value: 24

#### public static final int
**CENNAM**

<br />

Constant Value: 28

#### public static final int
**CENOFF**

<br />

Constant Value: 42

#### public static final long
**CENSIG**

<br />

Constant Value: 33639248

#### public static final int
**CENSIZ**

<br />

Constant Value: 20

#### public static final int
**CENTIM**

<br />

Constant Value: 12

#### public static final int
**CENVEM**

<br />

Constant Value: 4

#### public static final int
**CENVER**

<br />

Constant Value: 6

#### public static final int
**DEFLATED**

Compression method for compressed (DEFLATED) entries.
Constant Value: 8

#### public static final int
**ENDCOM**

<br />

Constant Value: 20

#### public static final int
**ENDHDR**

<br />

Constant Value: 22

#### public static final int
**ENDOFF**

<br />

Constant Value: 16

#### public static final long
**ENDSIG**

<br />

Constant Value: 101010256

#### public static final int
**ENDSIZ**

<br />

Constant Value: 12

#### public static final int
**ENDSUB**

<br />

Constant Value: 8

#### public static final int
**ENDTOT**

<br />

Constant Value: 10

#### public static final int
**EXTCRC**

<br />

Constant Value: 4

#### public static final int
**EXTHDR**

<br />

Constant Value: 16

#### public static final int
**EXTLEN**

<br />

Constant Value: 12

#### public static final long
**EXTSIG**

<br />

Constant Value: 134695760

#### public static final int
**EXTSIZ**

<br />

Constant Value: 8

#### public static final int
**LOCCRC**

<br />

Constant Value: 14

#### public static final int
**LOCEXT**

<br />

Constant Value: 28

#### public static final int
**LOCFLG**

<br />

Constant Value: 6

#### public static final int
**LOCHDR**

<br />

Constant Value: 30

#### public static final int
**LOCHOW**

<br />

Constant Value: 8

#### public static final int
**LOCLEN**

<br />

Constant Value: 22

#### public static final int
**LOCNAM**

<br />

Constant Value: 26

#### public static final long
**LOCSIG**

<br />

Constant Value: 67324752

#### public static final int
**LOCSIZ**

<br />

Constant Value: 18

#### public static final int
**LOCTIM**

<br />

Constant Value: 10

#### public static final int
**LOCVER**

<br />

Constant Value: 4

#### public static final int
**STORED**

Compression method for uncompressed (STORED) entries.
Constant Value: 0

## Public Constructors

#### public
**ZipOutputStream**
([OutputStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/OutputStream.html) out)

Creates a new ZIP output stream.

The UTF-8 `https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/charset/Charset.html` is used
to encode the entry names and comments.

##### Parameters

| out | the actual output stream |
|---|---|

#### public
**ZipOutputStream**
([OutputStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/OutputStream.html) out, [Charset](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/charset/Charset.html) charset)

Creates a new ZIP output stream.

##### Parameters

| out | the actual output stream |
| charset | the {@linkplain java.nio.charset.Charset charset} to be used to encode the entry names and comments |
|---|---|

## Public Methods

#### public void
**close**
()

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

##### Throws

| [ZipException](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/zip/ZipException.html) | if a ZIP file error has occurred |
| [IOException](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/IOException.html) | if an I/O error has occurred |
|---|---|

#### public void
**closeEntry**
()

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

##### Throws

| [ZipException](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/zip/ZipException.html) | if a ZIP format error has occurred |
| [IOException](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/IOException.html) | if an I/O error has occurred |
|---|---|

#### public void
**finish**
()

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.

##### Throws

| [ZipException](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/zip/ZipException.html) | if a ZIP file error has occurred |
| [IOException](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/IOException.html) | if an I/O exception has occurred |
|---|---|

#### public void
**putNextEntry**
([ZipEntry](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/zip/ZipEntry.html) e)

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.

##### Parameters

| e | the ZIP entry to be written |
|---|---|

##### Throws

| [ZipException](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/zip/ZipException.html) | if a ZIP format error has occurred |
| [IOException](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/IOException.html) | if an I/O error has occurred |
|---|---|

#### public void
**setComment**
([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) comment)

Sets the ZIP file comment.

##### Parameters

| comment | the comment string |
|---|---|

##### Throws

| [IllegalArgumentException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/IllegalArgumentException.html) | if the length of the specified ZIP file comment is greater than 0xFFFF bytes |
|---|---|

#### public void
**setLevel**
(int level)

Sets the compression level for subsequent entries which are DEFLATED.
The default setting is DEFAULT_COMPRESSION.

##### Parameters

| level | the compression level (0-9) |
|---|---|

##### Throws

| [IllegalArgumentException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/IllegalArgumentException.html) | if the compression level is invalid |
|---|---|

#### 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.

##### Parameters

| method | the default compression method |
|---|---|

##### Throws

| [IllegalArgumentException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/IllegalArgumentException.html) | if the specified compression method is invalid |
|---|---|

#### public synchronized void
**write**
(byte\[\] b, int off, int len)

Writes an array of bytes to the current ZIP entry data. This method
will block until all the bytes are written.

##### Parameters

| b | the data to be written |
| off | the start offset in the data |
| len | the number of bytes that are written |
|---|---|

##### Throws

| [ZipException](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/zip/ZipException.html) | if a ZIP file error has occurred |
| [IOException](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/IOException.html) | if an I/O error has occurred |
|---|---|