commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r446851 - in /jakarta/commons/proper/httpclient/trunk: release_notes.txt src/java/org/apache/commons/httpclient/ContentLengthInputStream.java
Date Sat, 16 Sep 2006 10:36:35 GMT
Author: olegk
Date: Sat Sep 16 03:36:35 2006
New Revision: 446851

URL: http://svn.apache.org/viewvc?view=rev&rev=446851
Log:
Fix for [HTTPCLIENT-598]: ContentLengthInputStream does not implement available() properly

Contributed by Igor Lubashev <igorlord at yahoo.com>
Reviewed by Oleg Kalnichevski

Modified:
    jakarta/commons/proper/httpclient/trunk/release_notes.txt
    jakarta/commons/proper/httpclient/trunk/src/java/org/apache/commons/httpclient/ContentLengthInputStream.java

Modified: jakarta/commons/proper/httpclient/trunk/release_notes.txt
URL: http://svn.apache.org/viewvc/jakarta/commons/proper/httpclient/trunk/release_notes.txt?view=diff&rev=446851&r1=446850&r2=446851
==============================================================================
--- jakarta/commons/proper/httpclient/trunk/release_notes.txt (original)
+++ jakarta/commons/proper/httpclient/trunk/release_notes.txt Sat Sep 16 03:36:35 2006
@@ -1,6 +1,9 @@
 -------------------
 Changes since Release 3.1 Alpha 1:
 
+* [HTTPCLIENT-598] - Fixed ContentLengthInputStream#available()
+           Contributed by Igor Lubashev <igorlord at yahoo.com>
+
 * [HTTPCLIENT-597] - Improved handling of idle connections in the multithreaded HTTP connection

            manager. 
            Contributed by Michael Becke <mbecke at apache.org>

Modified: jakarta/commons/proper/httpclient/trunk/src/java/org/apache/commons/httpclient/ContentLengthInputStream.java
URL: http://svn.apache.org/viewvc/jakarta/commons/proper/httpclient/trunk/src/java/org/apache/commons/httpclient/ContentLengthInputStream.java?view=diff&rev=446851&r1=446850&r2=446851
==============================================================================
--- jakarta/commons/proper/httpclient/trunk/src/java/org/apache/commons/httpclient/ContentLengthInputStream.java
(original)
+++ jakarta/commons/proper/httpclient/trunk/src/java/org/apache/commons/httpclient/ContentLengthInputStream.java
Sat Sep 16 03:36:35 2006
@@ -204,4 +204,16 @@
         }
         return length;
     }
+
+    public int available() throws IOException {
+        if (this.closed) {
+            return 0;
+        }
+        int avail = this.wrappedStream.available();
+        if (this.pos + avail > this.contentLength ) {
+            avail = (int)(this.contentLength - this.pos);
+        }
+        return avail;     
+    }
+    
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message