poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 13478] - [PATCH] [RFE] POIFS, RawDataBlock: Missing workaround for low performance InputStreams
Date Fri, 13 Jun 2003 21:36:26 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=13478>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=13478

[PATCH] [RFE] POIFS, RawDataBlock: Missing workaround for low performance InputStreams





------- Additional Comments From chris@sixlegs.com  2003-06-13 21:36 -------
>> I believe InputStream.Available() will return 0 where as InputStream.read() 
                       
>> will return >0                 

This is true.                                                                     
                                                                               
                    
>> This would in turn imply BufferedInputStream.read() could return 0 even if  
                       
>> len!=0

Nope, BufferedInputStream must adhere to the InputStream contract. It says it
does too: "This method implements the general contract of the corresponding read
method of the InputStream class."

The checking of available only occures after the initial read of the underlying
stream. The first read is done w/o checking available: "If the first read on the
underlying stream returns -1 to indicate end-of-file then this method returns
-1. Otherwise this method returns the number of bytes actually read."

So, it is impossible for BufferedInputStream (or any correctly implemented
InputStream) to return zero unless len == 0.

Chris

Mime
View raw message