RFR: 8268435: (ch) ChannelInputStream could override readAllBytes [v3]
Alan Bateman
alanb at openjdk.java.net
Sat Sep 25 11:51:55 UTC 2021
On Fri, 24 Sep 2021 22:36:29 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:
>> This change would override `readAllBytes()` and `readNBytes(int)` in `ChannelInputStream` thereby improving performance for all but smaller streams.
>
> Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision:
>
> 8268435: Create a TestNG test based on the previous changes to Basic.java
Changes requested by alanb (Reviewer).
test/jdk/sun/nio/ch/ChannelInputStream.java line 55:
> 53: import org.testng.annotations.Test;
> 54:
> 55: public class ChannelInputStream {
The tests for Channels API are in java/nio/channels/Channels and we should keep them in tree if possible. If test is focused on readXXXBytes then we should come up with a better name for the test, maybe "ReadXBytesTest" rather than "ChannelInputStream".
test/jdk/sun/nio/ch/ChannelInputStream.java line 106:
> 104: } finally {
> 105: file.delete();
> 106: }
It might be easy to maintain if we split this up so there are separate tests for empty files, OOME, etc.
Are you planning to update the test cover the case that the initial position is > 0?
Has the setup been copied from an older test, I'm wondering why it needs to use File and FileChannel::getChannel as you should be able to use FileChannel.open.
test/jdk/sun/nio/ch/ChannelInputStream.java line 141:
> 139: } finally {
> 140: file.delete();
> 141: }
It might be easy to maintain if this one were split up too.
-------------
PR: https://git.openjdk.java.net/jdk/pull/5645
More information about the nio-dev
mailing list