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:27:59 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 sys@yahoo.com  2003-06-13 21:27 -------
Chris:

you're correct in that according to the javadocs, InputStream.read()
says:
"If len is zero, then no bytes are read and 0 is returned; otherwise, there is 
an attempt to read at least one byte. If no byte is available because the 
stream is at end of file, the value -1 is returned; otherwise, at least one 
byte is read and stored into b."

however, the javadoc from BufferedInputStream.read() says:
"This iterated read continues until one of the following conditions becomes 
true:
    * The specified number of bytes have been read,
    * The read method of the underlying stream returns -1, indicating end-of-
file
    * The available method of the underlying stream returns zero, indicating
that further input requests would block."


I believe InputStream.Available() will return 0 where as InputStream.read() 
will return >0

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

Perhaps you're right and the timeout loop is unncessary, but even so, my
code should still work at least as well as yours.

Mime
View raw message