DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=27366>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=27366

GetMethod.getResponseBodyAsStream() .available() could return content-length





------- Additional Comments From [EMAIL PROTECTED]  2004-03-09 08:51 -------
George,

Even Gossling can write sub-optimal code. We all know there is some very bad
code in the Java Standard API :-) InputStream::available() is clearly documented
as "Returns the number of bytes that can be read (or skipped over) from this
input stream without blocking by the next caller of a method for this input
stream." Not following this contract is one bad thing. The user relying on us to
follow a different contract than the original method is even worse.
Also the nature of a stream allows for an infinite stream of data. I guess that
this was the reason that the Java API provides no way of figuring out the length
of a stream. And it is the same reason for us to provide this completely
optional piece of information with a supplementary method called
getResponseContentLength(). It can even return -1 if the content length is unknown.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to