On Wed, 17 Feb 2021 15:37:11 GMT, Alan Bateman <al...@openjdk.org> wrote:

>> Philippe Marschall has updated the pull request incrementally with two 
>> additional commits since the last revision:
>> 
>>  - Replace c-style array declarations
>>  - Share work buffer between #skip and #read
>
> src/java.base/share/classes/java/io/Reader.java line 221:
> 
>> 219:                     // if the last call to read returned -1 or the 
>> number of bytes
>> 220:                     // requested have been read then break
>> 221:                 } while (n >= 0 && remaining > 0);
> 
> The code for case that the char buffer has a backing array looks okay but I'm 
> not sure about the direct buffer/other cases. One concern is that this is a 
> read method, not a transferXXX method so we shouldn't be calling the 
> underlying read several times. You'll see what I mean if you consider the 
> scenario where you read < rem, then read again and the second read blocks or 
> throws. I'l also concerned about "workBuffer" adding more per-stream 
> footprint for cases where skip or read(CB) is used. Objects such as 
> InputStreamReader are already a problem due to the underlying stream decoder.

I think that's what @AlanBateman intended. The `skip()` changes would revert 
also (I think) but the C-style array changes can stay. Thanks.

-------------

PR: https://git.openjdk.java.net/jdk/pull/1915

Reply via email to