Return-Path: Delivered-To: apmail-incubator-harmony-commits-archive@www.apache.org Received: (qmail 18765 invoked from network); 21 Jun 2006 03:56:38 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 21 Jun 2006 03:56:38 -0000 Received: (qmail 23040 invoked by uid 500); 21 Jun 2006 03:56:38 -0000 Delivered-To: apmail-incubator-harmony-commits-archive@incubator.apache.org Received: (qmail 22952 invoked by uid 500); 21 Jun 2006 03:56:37 -0000 Mailing-List: contact harmony-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: harmony-dev@incubator.apache.org Delivered-To: mailing list harmony-commits@incubator.apache.org Received: (qmail 22941 invoked by uid 99); 21 Jun 2006 03:56:37 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 20 Jun 2006 20:56:37 -0700 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [140.211.166.113] (HELO eris.apache.org) (140.211.166.113) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 20 Jun 2006 20:56:37 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id F12221A983E; Tue, 20 Jun 2006 20:56:16 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r415894 - /incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/Deflater.java Date: Wed, 21 Jun 2006 03:56:16 -0000 To: harmony-commits@incubator.apache.org From: ndbeyer@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20060621035616.F12221A983E@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: ndbeyer Date: Tue Jun 20 20:56:16 2006 New Revision: 415894 URL: http://svn.apache.org/viewvc?rev=415894&view=rev Log: Remove unused field and minor cleanup. Modified: incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/Deflater.java Modified: incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/Deflater.java URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/Deflater.java?rev=415894&r1=415893&r2=415894&view=diff ============================================================================== --- incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/Deflater.java (original) +++ incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/Deflater.java Tue Jun 20 20:56:16 2006 @@ -47,8 +47,6 @@ private int flushParm = Z_NO_FLUSH; - private boolean noHeader; - private boolean finished; int compressLevel = DEFAULT_COMPRESSION; @@ -96,12 +94,14 @@ * */ public synchronized int deflate(byte[] buf, int off, int nbytes) { - if (streamHandle == -1) - throw new IllegalStateException(); + if (streamHandle == -1) { + throw new IllegalStateException(); + } // avoid int overflow, check null buf if (off <= buf.length && nbytes >= 0 && off >= 0 - && buf.length - off >= nbytes) - return deflateImpl(buf, off, nbytes, streamHandle, flushParm); + && buf.length - off >= nbytes) { + return deflateImpl(buf, off, nbytes, streamHandle, flushParm); + } throw new ArrayIndexOutOfBoundsException(); } @@ -160,8 +160,9 @@ * @see #setDictionary(byte[], int, int) */ public synchronized int getAdler() { - if (streamHandle == -1) - throw new IllegalStateException(); + if (streamHandle == -1) { + throw new IllegalStateException(); + } return getAdlerImpl(streamHandle); } @@ -174,8 +175,9 @@ * @return number of bytes of input read. */ public synchronized int getTotalIn() { - if (streamHandle == -1) - throw new IllegalStateException(); + if (streamHandle == -1) { + throw new IllegalStateException(); + } return (int)getTotalInImpl(streamHandle); } @@ -183,13 +185,14 @@ private native synchronized long getTotalInImpl(long handle); /** - * Returns the total number of compressed bytes output nby this Deflater. + * Returns the total number of compressed bytes output by this Deflater. * * @return number of compressed bytes output. */ public synchronized int getTotalOut() { - if (streamHandle == -1) - throw new IllegalStateException(); + if (streamHandle == -1) { + throw new IllegalStateException(); + } return (int)getTotalOutImpl(streamHandle); } @@ -203,15 +206,16 @@ * have been provided to the Deflater finish() must be called to ensure the * compressed data is output. * - * @return True if input is reuired for deflation to continue, false + * @return True if input is required for deflation to continue, false * otherwise * @see #finished() * @see #setInput(byte[]) * @see #setInput(byte[], int, int) */ public boolean needsInput() { - if (inputBuffer == null) - return true; + if (inputBuffer == null) { + return true; + } return inRead == inLength; } @@ -224,8 +228,9 @@ * @see #finished */ public synchronized void reset() { - if (streamHandle == -1) - throw new NullPointerException(); + if (streamHandle == -1) { + throw new NullPointerException(); + } flushParm = Z_NO_FLUSH; finished = false; @@ -248,14 +253,16 @@ * @see Deflater#Deflater(int, boolean) */ public synchronized void setDictionary(byte[] buf, int off, int nbytes) { - if (streamHandle == -1) - throw new IllegalStateException(); + if (streamHandle == -1) { + throw new IllegalStateException(); + } // avoid int overflow, check null buf if (off <= buf.length && nbytes >= 0 && off >= 0 - && buf.length - off >= nbytes) - setDictionaryImpl(buf, off, nbytes, streamHandle); - else - throw new ArrayIndexOutOfBoundsException(); + && buf.length - off >= nbytes) { + setDictionaryImpl(buf, off, nbytes, streamHandle); + } else { + throw new ArrayIndexOutOfBoundsException(); + } } private native synchronized void setDictionaryImpl(byte[] buf, int off, @@ -275,19 +282,22 @@ * starting at off and ending at nbytes - 1. */ public synchronized void setInput(byte[] buf, int off, int nbytes) { - if (streamHandle == -1) - throw new IllegalStateException(); + if (streamHandle == -1) { + throw new IllegalStateException(); + } // avoid int overflow, check null buf if (off <= buf.length && nbytes >= 0 && off >= 0 && buf.length - off >= nbytes) { inLength = nbytes; inRead = 0; - if (inputBuffer == null) - setLevelsImpl(compressLevel, strategy, streamHandle); + if (inputBuffer == null) { + setLevelsImpl(compressLevel, strategy, streamHandle); + } inputBuffer = buf; setInputImpl(buf, off, nbytes, streamHandle); - } else - throw new ArrayIndexOutOfBoundsException(); + } else { + throw new ArrayIndexOutOfBoundsException(); + } } private native synchronized void setLevelsImpl(int level, int strategy, @@ -307,10 +317,12 @@ * If the compression level is invalid. */ public synchronized void setLevel(int level) { - if (level < DEFAULT_COMPRESSION || level > BEST_COMPRESSION) - throw new IllegalArgumentException(); - if (inputBuffer != null) - throw new IllegalStateException(); + if (level < DEFAULT_COMPRESSION || level > BEST_COMPRESSION) { + throw new IllegalArgumentException(); + } + if (inputBuffer != null) { + throw new IllegalStateException(); + } compressLevel = level; } @@ -326,10 +338,12 @@ * HUFFMAN_ONLY or DEFAULT_STRATEGY. */ public synchronized void setStrategy(int strategy) { - if (strategy < DEFAULT_STRATEGY || strategy > HUFFMAN_ONLY) - throw new IllegalArgumentException(); - if (inputBuffer != null) - throw new IllegalStateException(); + if (strategy < DEFAULT_STRATEGY || strategy > HUFFMAN_ONLY) { + throw new IllegalArgumentException(); + } + if (inputBuffer != null) { + throw new IllegalStateException(); + } this.strategy = strategy; } @@ -353,10 +367,10 @@ * if true do not write the ZLIB header */ public Deflater(int level, boolean noHeader) { - if (level < DEFAULT_COMPRESSION || level > BEST_COMPRESSION) - throw new IllegalArgumentException(); + if (level < DEFAULT_COMPRESSION || level > BEST_COMPRESSION) { + throw new IllegalArgumentException(); + } compressLevel = level; - this.noHeader = noHeader; streamHandle = createStream(compressLevel, strategy, noHeader); } @@ -382,8 +396,9 @@ */ public synchronized long getBytesRead() { // Throw NPE here - if (streamHandle == -1) - throw new NullPointerException(); + if (streamHandle == -1) { + throw new NullPointerException(); + } return getTotalInImpl(streamHandle); } @@ -397,8 +412,9 @@ */ public synchronized long getBytesWritten() { // Throw NPE here - if (streamHandle == -1) + if (streamHandle == -1) { throw new NullPointerException(); + } return getTotalOutImpl(streamHandle); }