<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<!--NewPage-->
<html>
<head>
<!-- Generated by javadoc on Wed Jul 28 01:21:15 GMT 1999 -->
<title>
  Class java.util.zip.Deflater
</title>
</head>
<body>
<a name="_top_"></a>
<pre>
<a href="packages.html">All Packages</a>  <a href="tree.html">Class Hierarchy</a>  <a href="Package-java.util.zip.html">This Package</a>  <a href="java.util.zip.CheckedOutputStream.html#_top_">Previous</a>  <a href="java.util.zip.DeflaterOutputStream.html#_top_">Next</a>  <a href="AllNames.html">Index</a></pre>
<hr>
<h1>
  Class java.util.zip.Deflater
</h1>
<pre>
<a href="java.lang.Object.html#_top_">java.lang.Object</a>
   |
   +----java.util.zip.Deflater
</pre>
<hr>
<dl>
  <dt> public class <b>Deflater</b>
  <dt> extends <a href="java.lang.Object.html#_top_">Object</a>
</dl>
This class provides support for general purpose decompression using
 the popular ZLIB compression library. The ZLIB compression library
 was initially developed as part of the PNG graphics standard and is
 not protected by patents. It is fully described in RFCs 1950, 1951,
 and 1952, which can be found at
 <a href="http://info.internet.isi.edu:80/in-notes/rfc/files/">
 http://info.internet.isi.edu:80/in-notes/rfc/files/
 </a> in the files rfc1950.txt (zlib format),
 rfc1951.txt (deflate format) and rfc1952.txt (gzip format).
<p>
<dl>
    <dt> <b>See Also:</b>
    <dd> <a href="java.util.zip.Inflater.html#_top_">Inflater</a>
</dl>
<hr>
<a name="index"></a>
<h2>
  <img src="images/variable-index.gif" width=207 height=38 alt="Variable Index">
</h2>
<dl>
  <dt> <img src="images/blue-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#BEST_COMPRESSION"><b>BEST_COMPRESSION</b></a>
  <dd>  Compression level for best compression.
  <dt> <img src="images/blue-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#BEST_SPEED"><b>BEST_SPEED</b></a>
  <dd>  Compression level for fastest compression.
  <dt> <img src="images/blue-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#DEFAULT_COMPRESSION"><b>DEFAULT_COMPRESSION</b></a>
  <dd>  Default compression level.
  <dt> <img src="images/blue-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#DEFAULT_STRATEGY"><b>DEFAULT_STRATEGY</b></a>
  <dd>  Default compression strategy.
  <dt> <img src="images/blue-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#DEFLATED"><b>DEFLATED</b></a>
  <dd>  Compression method for the deflate algorithm (the only one currently
 supported).
  <dt> <img src="images/blue-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#FILTERED"><b>FILTERED</b></a>
  <dd>  Compression strategy best used for data consisting mostly of small
 values with a somewhat random distribution.
  <dt> <img src="images/blue-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#HUFFMAN_ONLY"><b>HUFFMAN_ONLY</b></a>
  <dd>  Compression strategy for Huffman coding only.
  <dt> <img src="images/blue-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#NO_COMPRESSION"><b>NO_COMPRESSION</b></a>
  <dd>  Compression level for no compression.
</dl>
<h2>
  <img src="images/constructor-index.gif" width=275 height=38 alt="Constructor Index">
</h2>
<dl>
  <dt> <img src="images/yellow-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#Deflater()"><b>Deflater</b></a>()
  <dd>  Creates a new compressor with the default compression level.
  <dt> <img src="images/yellow-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#Deflater(int)"><b>Deflater</b></a>(int)
  <dd>  Creates a new compressor using the specified compression level.
  <dt> <img src="images/yellow-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#Deflater(int, boolean)"><b>Deflater</b></a>(int, boolean)
  <dd>  Creates a new compressor using the specified compression level.
</dl>
<h2>
  <img src="images/method-index.gif" width=207 height=38 alt="Method Index">
</h2>
<dl>
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#deflate(byte[])"><b>deflate</b></a>(byte[])
  <dd>  Fills specified buffer with compressed data.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#deflate(byte[], int, int)"><b>deflate</b></a>(byte[], int, int)
  <dd>  Fills specified buffer with compressed data.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#end()"><b>end</b></a>()
  <dd>  Discards unprocessed input and frees internal data.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#finalize()"><b>finalize</b></a>()
  <dd>  Frees the compressor when garbage is collected.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#finish()"><b>finish</b></a>()
  <dd>  When called, indicates that compression should end with the current
 contents of the input buffer.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#finished()"><b>finished</b></a>()
  <dd>  Returns true if the end of the compressed data output stream has
 been reached.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#getAdler()"><b>getAdler</b></a>()
  <dd>  Returns the ADLER-32 value of the uncompressed data.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#getTotalIn()"><b>getTotalIn</b></a>()
  <dd>  Returns the total number of bytes input so far.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#getTotalOut()"><b>getTotalOut</b></a>()
  <dd>  Returns the total number of bytes output so far.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#needsInput()"><b>needsInput</b></a>()
  <dd>  Returns true if the input data buffer is empty and setInput()
 should be called in order to provide more input.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#reset()"><b>reset</b></a>()
  <dd>  Resets deflater so that a new set of input data can be processed.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#setDictionary(byte[])"><b>setDictionary</b></a>(byte[])
  <dd>  Sets preset dictionary for compression.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#setDictionary(byte[], int, int)"><b>setDictionary</b></a>(byte[], int, int)
  <dd>  Sets preset dictionary for compression.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#setInput(byte[])"><b>setInput</b></a>(byte[])
  <dd>  Sets input data for compression.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#setInput(byte[], int, int)"><b>setInput</b></a>(byte[], int, int)
  <dd>  Sets input data for compression.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#setLevel(int)"><b>setLevel</b></a>(int)
  <dd>  Sets the current compression level to the specified value.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#setStrategy(int)"><b>setStrategy</b></a>(int)
  <dd>  Sets the compression strategy to the specified value.
</dl>
<a name="variables"></a>
<h2>
  <img src="images/variables.gif" width=153 height=38 alt="Variables">
</h2>
<a name="DEFLATED"><img src="images/blue-ball.gif" width=12 height=12 alt=" o "></a>
<b>DEFLATED</b>
<pre>
 public static final int DEFLATED
</pre>
<dl>
  <dd> Compression method for the deflate algorithm (the only one currently
 supported).<p>
</dl>
<a name="NO_COMPRESSION"><img src="images/blue-ball.gif" width=12 height=12 alt=" o "></a>
<b>NO_COMPRESSION</b>
<pre>
 public static final int NO_COMPRESSION
</pre>
<dl>
  <dd> Compression level for no compression.<p>
</dl>
<a name="BEST_SPEED"><img src="images/blue-ball.gif" width=12 height=12 alt=" o "></a>
<b>BEST_SPEED</b>
<pre>
 public static final int BEST_SPEED
</pre>
<dl>
  <dd> Compression level for fastest compression.<p>
</dl>
<a name="BEST_COMPRESSION"><img src="images/blue-ball.gif" width=12 height=12 alt=" o "></a>
<b>BEST_COMPRESSION</b>
<pre>
 public static final int BEST_COMPRESSION
</pre>
<dl>
  <dd> Compression level for best compression.<p>
</dl>
<a name="DEFAULT_COMPRESSION"><img src="images/blue-ball.gif" width=12 height=12 alt=" o "></a>
<b>DEFAULT_COMPRESSION</b>
<pre>
 public static final int DEFAULT_COMPRESSION
</pre>
<dl>
  <dd> Default compression level.<p>
</dl>
<a name="FILTERED"><img src="images/blue-ball.gif" width=12 height=12 alt=" o "></a>
<b>FILTERED</b>
<pre>
 public static final int FILTERED
</pre>
<dl>
  <dd> Compression strategy best used for data consisting mostly of small
 values with a somewhat random distribution. Forces more Huffman coding
 and less string matching.<p>
</dl>
<a name="HUFFMAN_ONLY"><img src="images/blue-ball.gif" width=12 height=12 alt=" o "></a>
<b>HUFFMAN_ONLY</b>
<pre>
 public static final int HUFFMAN_ONLY
</pre>
<dl>
  <dd> Compression strategy for Huffman coding only.<p>
</dl>
<a name="DEFAULT_STRATEGY"><img src="images/blue-ball.gif" width=12 height=12 alt=" o "></a>
<b>DEFAULT_STRATEGY</b>
<pre>
 public static final int DEFAULT_STRATEGY
</pre>
<dl>
  <dd> Default compression strategy.<p>
</dl>
<a name="constructors"></a>
<h2>
  <img src="images/constructors.gif" width=231 height=38 alt="Constructors">
</h2>
<a name="Deflater"></a>
<a name="Deflater(int, boolean)"><img src="images/yellow-ball.gif" width=12 height=12 alt=" o "></a>
<b>Deflater</b>
<pre>
 public Deflater(int level,
                 boolean nowrap)
</pre>
<dl>
  <dd> Creates a new compressor using the specified compression level.
 If 'nowrap' is true then the ZLIB header and checksum fields will
 not be used in order to support the compression format used in
 both GZIP and PKZIP.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> level - the compression level (0-9)
    <dd> nowrap - if true then use GZIP compatible compression
  </dl></dd>
</dl>
<a name="Deflater(int)"><img src="images/yellow-ball.gif" width=12 height=12 alt=" o "></a>
<b>Deflater</b>
<pre>
 public Deflater(int level)
</pre>
<dl>
  <dd> Creates a new compressor using the specified compression level.
 Compressed data will be generated in ZLIB format.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> level - the compression level (0-9)
  </dl></dd>
</dl>
<a name="Deflater()"><img src="images/yellow-ball.gif" width=12 height=12 alt=" o "></a>
<b>Deflater</b>
<pre>
 public Deflater()
</pre>
<dl>
  <dd> Creates a new compressor with the default compression level.
 Compressed data will be generated in ZLIB format.
<p>
</dl>
<a name="methods"></a>
<h2>
  <img src="images/methods.gif" width=151 height=38 alt="Methods">
</h2>
<a name="setInput(byte[], int, int)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="setInput"><b>setInput</b></a>
<pre>
 public synchronized void setInput(byte b[],
                                   int off,
                                   int len)
</pre>
<dl>
  <dd> Sets input data for compression. This should be called whenever
 needsInput() returns true indicating that more input data is required.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> b - the input data bytes
    <dd> off - the start offset of the data
    <dd> len - the length of the data
    <dt> <b>See Also:</b>
    <dd> <a href="#needsInput">needsInput</a>
  </dl></dd>
</dl>
<a name="setInput(byte[])"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="setInput"><b>setInput</b></a>
<pre>
 public void setInput(byte b[])
</pre>
<dl>
  <dd> Sets input data for compression. This should be called whenever
 needsInput() returns true indicating that more input data is required.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> b - the input data bytes
    <dt> <b>See Also:</b>
    <dd> <a href="#needsInput">needsInput</a>
  </dl></dd>
</dl>
<a name="setDictionary(byte[], int, int)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="setDictionary"><b>setDictionary</b></a>
<pre>
 public native synchronized void setDictionary(byte b[],
                                               int off,
                                               int len)
</pre>
<dl>
  <dd> Sets preset dictionary for compression. A preset dictionary is used
 when the history buffer can be predetermined. When the data is later
 uncompressed with Inflater.inflate(), Inflater.getAdler() can be called
 in order to get the Adler-32 value of the dictionary required for
 decompression.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> b - the dictionary data bytes
    <dd> off - the start offset of the data
    <dd> len - the length of the data
    <dt> <b>See Also:</b>
    <dd> <a href="java.util.zip.Inflater.html#inflate">inflate</a>, <a href="java.util.zip.Inflater.html#getAdler">getAdler</a>
  </dl></dd>
</dl>
<a name="setDictionary(byte[])"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="setDictionary"><b>setDictionary</b></a>
<pre>
 public void setDictionary(byte b[])
</pre>
<dl>
  <dd> Sets preset dictionary for compression. A preset dictionary is used
 when the history buffer can be predetermined. When the data is later
 uncompressed with Inflater.inflate(), Inflater.getAdler() can be called
 in order to get the Adler-32 value of the dictionary required for
 decompression.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> b - the dictionary data bytes
    <dt> <b>See Also:</b>
    <dd> <a href="java.util.zip.Inflater.html#inflate">inflate</a>, <a href="java.util.zip.Inflater.html#getAdler">getAdler</a>
  </dl></dd>
</dl>
<a name="setStrategy(int)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="setStrategy"><b>setStrategy</b></a>
<pre>
 public synchronized void setStrategy(int strategy)
</pre>
<dl>
  <dd> Sets the compression strategy to the specified value.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> strategy - the new compression strategy
    <dt> <b>Throws:</b> <a href="java.lang.IllegalArgumentException.html#_top_">IllegalArgumentException</a>
    <dd> if the compression strategy is
				           invalid
  </dl></dd>
</dl>
<a name="setLevel(int)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="setLevel"><b>setLevel</b></a>
<pre>
 public synchronized void setLevel(int level)
</pre>
<dl>
  <dd> Sets the current compression level to the specified value.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> level - the new compression level (0-9)
    <dt> <b>Throws:</b> <a href="java.lang.IllegalArgumentException.html#_top_">IllegalArgumentException</a>
    <dd> if the compression level is invalid
  </dl></dd>
</dl>
<a name="needsInput()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="needsInput"><b>needsInput</b></a>
<pre>
 public boolean needsInput()
</pre>
<dl>
  <dd> Returns true if the input data buffer is empty and setInput()
 should be called in order to provide more input.
<p>
</dl>
<a name="finish()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="finish"><b>finish</b></a>
<pre>
 public synchronized void finish()
</pre>
<dl>
  <dd> When called, indicates that compression should end with the current
 contents of the input buffer.
<p>
</dl>
<a name="finished()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="finished"><b>finished</b></a>
<pre>
 public synchronized boolean finished()
</pre>
<dl>
  <dd> Returns true if the end of the compressed data output stream has
 been reached.
<p>
</dl>
<a name="deflate(byte[], int, int)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="deflate"><b>deflate</b></a>
<pre>
 public native synchronized int deflate(byte b[],
                                        int off,
                                        int len)
</pre>
<dl>
  <dd> Fills specified buffer with compressed data. Returns actual number
 of bytes of compressed data. A return value of 0 indicates that
 needsInput() should be called in order to determine if more input
 data is required.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> b - the buffer for the compressed data
    <dd> off - the start offset of the data
    <dd> len - the maximum number of bytes of compressed data
    <dt> <b>Returns:</b>
    <dd> the actual number of bytes of compressed data
  </dl></dd>
</dl>
<a name="deflate(byte[])"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="deflate"><b>deflate</b></a>
<pre>
 public int deflate(byte b[])
</pre>
<dl>
  <dd> Fills specified buffer with compressed data. Returns actual number
 of bytes of compressed data. A return value of 0 indicates that
 needsInput() should be called in order to determine if more input
 data is required.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> b - the buffer for the compressed data
    <dt> <b>Returns:</b>
    <dd> the actual number of bytes of compressed data
  </dl></dd>
</dl>
<a name="getAdler()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="getAdler"><b>getAdler</b></a>
<pre>
 public native synchronized int getAdler()
</pre>
<dl>
  <dd> Returns the ADLER-32 value of the uncompressed data.
<p>
</dl>
<a name="getTotalIn()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="getTotalIn"><b>getTotalIn</b></a>
<pre>
 public native synchronized int getTotalIn()
</pre>
<dl>
  <dd> Returns the total number of bytes input so far.
<p>
</dl>
<a name="getTotalOut()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="getTotalOut"><b>getTotalOut</b></a>
<pre>
 public native synchronized int getTotalOut()
</pre>
<dl>
  <dd> Returns the total number of bytes output so far.
<p>
</dl>
<a name="reset()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="reset"><b>reset</b></a>
<pre>
 public native synchronized void reset()
</pre>
<dl>
  <dd> Resets deflater so that a new set of input data can be processed.
 Keeps current compression level and strategy settings.
<p>
</dl>
<a name="end()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="end"><b>end</b></a>
<pre>
 public native synchronized void end()
</pre>
<dl>
  <dd> Discards unprocessed input and frees internal data.
<p>
</dl>
<a name="finalize()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="finalize"><b>finalize</b></a>
<pre>
 protected void finalize()
</pre>
<dl>
  <dd> Frees the compressor when garbage is collected.
<p>
  <dd><dl>
    <dt> <b>Overrides:</b>
    <dd> <a href="java.lang.Object.html#finalize()">finalize</a> in class <a href="java.lang.Object.html#_top_">Object</a>
  </dl></dd>
</dl>
<hr>
<pre>
<a href="packages.html">All Packages</a>  <a href="tree.html">Class Hierarchy</a>  <a href="Package-java.util.zip.html">This Package</a>  <a href="java.util.zip.CheckedOutputStream.html#_top_">Previous</a>  <a href="java.util.zip.DeflaterOutputStream.html#_top_">Next</a>  <a href="AllNames.html">Index</a></pre>
</body>
</html>
