2003-05-27 Michael Koch <konqueror@gmx.de>
* java/util/zip/Deflater.java (FILTERED): Merged documentation from classpath. * java/util/zip/DeflaterOutputStream.java (DeflaterOutputStream): Merged documentation and argument validity check from classpath. (deflate): Merged documentation from classpath. (finish): Likewise. * java/util/zip/Inflater.java (Inflater): Merged class documentation from classpath. (zstream): Reordered. (is_finished): Reordered. (dict_needed): Reordered. (Inflater): Reordered, merged documentation from classpath. (end): Likewise. (finalize): Merged documentation from classpath. (finished): Likewise. (getAdler): Likewise. (getRemaining): Likewise. (getTotalIn): Likewise. (getTotalOut): Likewise. (inflate): Likewise. (needsDictionary): Likewise. (needsInput): Likewise. (reset): Likewise. (setDictionary): Likewise. (setInput): Likewise. From-SVN: r67185
This commit is contained in:
parent
5191f392bb
commit
98ad580793
4 changed files with 278 additions and 70 deletions
|
@ -56,6 +56,7 @@ import java.io.IOException;
|
|||
* finishing the stream.
|
||||
*
|
||||
* @author Tom Tromey, Jochen Hoenicke
|
||||
* @date Jan 11, 2001
|
||||
*/
|
||||
public class DeflaterOutputStream extends FilterOutputStream
|
||||
{
|
||||
|
@ -65,6 +66,11 @@ public class DeflaterOutputStream extends FilterOutputStream
|
|||
out.close();
|
||||
}
|
||||
|
||||
/**
|
||||
* Deflates everything in the def's input buffers. This will call
|
||||
* <code>def.deflate()</code> until all bytes from the input buffers
|
||||
* are processed.
|
||||
*/
|
||||
protected void deflate () throws IOException
|
||||
{
|
||||
do
|
||||
|
@ -76,23 +82,49 @@ public class DeflaterOutputStream extends FilterOutputStream
|
|||
while (! def.needsInput());
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new DeflaterOutputStream with a default Deflater and
|
||||
* default buffer size.
|
||||
* @param out the output stream where deflated output should be written.
|
||||
*/
|
||||
public DeflaterOutputStream (OutputStream out)
|
||||
{
|
||||
this (out, new Deflater (), 512);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new DeflaterOutputStream with the given Deflater and
|
||||
* default buffer size.
|
||||
* @param out the output stream where deflated output should be written.
|
||||
* @param defl the underlying deflater.
|
||||
*/
|
||||
public DeflaterOutputStream (OutputStream out, Deflater defl)
|
||||
{
|
||||
this (out, defl, 512);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new DeflaterOutputStream with the given Deflater and
|
||||
* buffer size.
|
||||
* @param out the output stream where deflated output should be written.
|
||||
* @param defl the underlying deflater.
|
||||
* @param bufsize the buffer size.
|
||||
* @exception IllegalArgumentException if bufsize isn't positive.
|
||||
*/
|
||||
public DeflaterOutputStream(OutputStream out, Deflater defl, int bufsize)
|
||||
{
|
||||
super (out);
|
||||
if (bufsize <= 0)
|
||||
throw new IllegalArgumentException("bufsize <= 0");
|
||||
buf = new byte[bufsize];
|
||||
def = defl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Finishes the stream by calling finish() on the deflater. This
|
||||
* was the only way to ensure that all bytes are flushed in Sun's
|
||||
* JDK.
|
||||
*/
|
||||
public void finish () throws IOException
|
||||
{
|
||||
if (inbufLength > 0)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue