poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrew C. Oliver" <acoli...@apache.org>
Subject Re: cvs commit: jakarta-poi/src/testcases/org/apache/poi/poifs/filesystem SlowInputStream.java TestDocument.java
Date Fri, 01 Aug 2003 13:33:10 GMT
On 8/1/03 6:58 AM, "rainer.klute@gmx.de" <rainer.klute@gmx.de> wrote:

>>   Slow input stream patch, bug 13478
>> ...
>>           for (;;) {
>>               int got = in.read(b, off + total, len - total);
>>               if (got < 0) {
>>                   return (total == 0) ? -1 : total;
>>               } else {
>>                   total += got;
>>                   if (total == len)
>>                       return total;
>>               }
>>           }
> 
> Hi Avik,
> 
> thanks for the patch! I suggest that the loop waits for a moment when read()
> received less bytes than expected. Otherwise it would be a waste of CPU
> cycles on very slow streams.
> 
> Best regards
> Rainer Klute

That and it needs a timeout as well.

-- 
Andrew C. Oliver
http://www.superlinksoftware.com/poi.jsp
Custom enhancements and Commercial Implementation for Jakarta POI

http://jakarta.apache.org/poi
For Java and Excel, Got POI?


---------------------------------------------------------------------
To unsubscribe, e-mail: poi-dev-unsubscribe@jakarta.apache.org
Mailing List:    http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta POI Project: http://jakarta.apache.org/poi/


Mime
View raw message