RFR: 8265891: (ch) InputStream returned by Channels.newInputStream should override transferTo
Alan Bateman
Alan.Bateman at oracle.com
Sun Jun 20 07:32:07 UTC 2021
On 18/06/2021 18:30, Brian Burkhalter wrote:
>
>> On Jun 18, 2021, at 6:36 AM, Alan Bateman <alanb at openjdk.java.net
>> <mailto:alanb at openjdk.java.net>> wrote:
>>
>> Adding an override of transferTo may require new tests. @bplb Do you
>> if we have good tests for all the scenarios where input stream
>> returned by Channels.newInputStream is the source?
>
> There are not a lot of tests for the `InputStream` returned by
> `Channels.newInputStream`:
>
> `java/nio/channels/Channels`:
>
> `Basic.java` - reading from a wrapped `FileChannel`
> `ReadByte.java` - trivial
> `Basic2.java` - reading at random offsets from a wrapped
> `AsynchronousSocketChannel`
> `ReadOffset.java` - trivial
>
> Elsewhere:
>
> `sun/nio/ch/TempBuffer.java`
> `jdk/nio/zipfs/ZipFSTester.java`
>
>
> I don’t see that `transferTo()` on such a stream is tested anywhere.
InputStream/TransferTo.java tests the default implementation. Maybe we
re-structured this to use a data provider so that the tests exercise
both the default implementation and the various overrides. Alternatively
a new test that exercises the various overrides in different scenarios.
In any case, I think the feedback for PR 4263 is that it is essentially
several implementations of transferTo and each of those need to have
test coverage.
-Alan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/nio-dev/attachments/20210620/4b94dd53/attachment.htm>
More information about the nio-dev
mailing list