RFR: 4926314: Optimize Reader.read(CharBuffer) [v7]

Philippe Marschall github.com+471021+marschall at openjdk.java.net
Sat Mar 13 14:33:07 UTC 2021


On Tue, 16 Feb 2021 23:52:09 GMT, Brian Burkhalter <bpb at 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
>
> test/jdk/java/io/InputStreamReader/ReadCharBuffer.java line 73:
> 
>> 71:         }
>> 72: 
>> 73:         buffer.clear();
> 
> I think `buffer.rewind()` would be more in keeping with the specification verbiage although there will be no practical effect here. Same comment applies below and in the other test `ReadCharBuffer`.

`buffer.rewind()` would not work in this specific case as it does not reset the limit. I want to assert the entire buffers content to make sure the method didn't accidentally write where it shouldn't have. Therefore limit needs to be set to capacity.

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

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


More information about the nio-dev mailing list