From 98ad5807938624cd8ceceec07250147f8783552f Mon Sep 17 00:00:00 2001 From: Michael Koch Date: Tue, 27 May 2003 06:34:29 +0000 Subject: 2003-05-27 Michael Koch * 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 --- libjava/java/util/zip/DeflaterOutputStream.java | 32 +++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'libjava/java/util/zip/DeflaterOutputStream.java') diff --git a/libjava/java/util/zip/DeflaterOutputStream.java b/libjava/java/util/zip/DeflaterOutputStream.java index 755d8e71420..ff66b080f9e 100644 --- a/libjava/java/util/zip/DeflaterOutputStream.java +++ b/libjava/java/util/zip/DeflaterOutputStream.java @@ -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 + * def.deflate() 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) -- cgit v1.2.3