RFR: 8279283 - BufferedInputStream should override transferTo [v9]
Markus KARG
duke at openjdk.org
Thu Sep 8 06:22:09 UTC 2022
On Thu, 8 Sep 2022 05:53:34 GMT, Jaikiran Pai <jpai at openjdk.org> wrote:
>> Markus KARG has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Revert "HexPrinter::transferTo"
>>
>> This reverts commit 6f0e2a8f7be5706b39a8e9bc88a97f34d2819098.
>
> test/jdk/java/io/BufferedInputStream/TransferTo.java line 105:
>
>> 103: public void testStreamContents() throws Exception {
>> 104: // factory for incoming data provider
>> 105: InputStreamProvider inputStreamProvider = byteArrayInput();
>
> Given that the implementation in this PR now calls the wrapped `InputStream`'s `transferTo` method, should we also include a test where the wrapped `InputStream` is a `FileInputStream` and the target `OutputStream` is a `FileOutputStream`, so that it exercises the `FileChannel#transferTo` code path and verifies the correct data is transferred?
The correctness of the actually written data is already checked in `checkTransferredContents`. I do not see what you win by replacing `ByteArrayInputStream` by `FileInputStream`. What additional risks do you cover, and what is so special about `FileInputStream` compared to any other `InputStream`? `FileInputStream::transferTo` is already checked by its own unit test.
-------------
PR: https://git.openjdk.org/jdk/pull/6935
More information about the core-libs-dev
mailing list