diff options
author | David Daney <ddaney@avtrex.com> | 2008-07-12 17:56:29 +0000 |
---|---|---|
committer | David Daney <ddaney@avtrex.com> | 2008-07-12 17:56:29 +0000 |
commit | 0fb3d958125be947008d45be6802fc5479505208 (patch) | |
tree | c138ae21706d360e729b8d778af5112115b54d30 | |
parent | 4fc2d39cc1d861176fd8207116613bd3764fbe0d (diff) | |
download | classpath-0fb3d958125be947008d45be6802fc5479505208.tar.gz |
* gnu/java/net/protocol/http/LimitedLengthInputStream.java: Clean up
white space in entire file.
(handleClose): Remove redundant braces from if statement.
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | gnu/java/net/protocol/http/LimitedLengthInputStream.java | 34 |
2 files changed, 21 insertions, 19 deletions
@@ -1,3 +1,9 @@ +2008-07-12 David Daney <ddaney@avtrex.com> + + * gnu/java/net/protocol/http/LimitedLengthInputStream.java: Clean up + white space in entire file. + (handleClose): Remove redundant braces from if statement. + 2008-07-07 Andrew John Hughes <gnu_andrew@member.fsf.org> * java/text/DateFormatSymbols.java: diff --git a/gnu/java/net/protocol/http/LimitedLengthInputStream.java b/gnu/java/net/protocol/http/LimitedLengthInputStream.java index 16cf56a29..568f830fd 100644 --- a/gnu/java/net/protocol/http/LimitedLengthInputStream.java +++ b/gnu/java/net/protocol/http/LimitedLengthInputStream.java @@ -1,5 +1,5 @@ /* LimitedLengthInputStream.java -- - Copyright (C) 2005 Free Software Foundation, Inc. + Copyright (C) 2005, 2008 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. - + GNU Classpath is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU @@ -57,20 +57,17 @@ class LimitedLengthInputStream private boolean eof; private InputStream in; private boolean doClose; - - + private void handleClose() throws IOException { eof = true; + if (doClose) - { - in.close(); - } + in.close(); else - { - connection.release(); - } + connection.release(); + in = null; connection = null; } @@ -85,7 +82,7 @@ class LimitedLengthInputStream * @param restrictLen if true the number of bytes that can be read * from this stream will be limited to maxLen, otherwise the number * of bytes is not restricted. - * + * * @param con the HTTPConnection associated with this stream * * @param doClose if true con will be closed when finished reading, @@ -98,7 +95,6 @@ class LimitedLengthInputStream HTTPConnection con, boolean doClose) throws IOException - { this.in = in; this.remainingLen = maxLen; @@ -122,7 +118,7 @@ class LimitedLengthInputStream return -1; // EOF int r; - + if (restrictLen) { r = in.read(); @@ -138,7 +134,7 @@ class LimitedLengthInputStream if (r == -1) handleClose(); } - + return r; } @@ -156,12 +152,12 @@ class LimitedLengthInputStream if (restrictLen && length > remainingLen) length = (int) remainingLen; - + int r = in.read(buffer, offset, length); - + if (-1 == r) handleClose(); - + if (restrictLen && r > 0) { remainingLen -= r; @@ -182,7 +178,7 @@ class LimitedLengthInputStream n = remainingLen; long r = in.skip(n); - + if (restrictLen) { remainingLen -= r; @@ -214,7 +210,7 @@ class LimitedLengthInputStream // it away. doClose = true; - + handleClose(); } } |