RFR: 8329829: HttpClient: Add a BodyPublishers.ofFileChannel method [v8]
Volkan Yazici
vyazici at openjdk.org
Tue Aug 19 15:28:43 UTC 2025
On Tue, 19 Aug 2025 09:18:06 GMT, Jaikiran Pai <jpai at openjdk.org> wrote:
>> Marked as reviewed by dfuchs (Reviewer).
>
>> I see you removed the explicit mention of the FileChannel#read(ByteBuffer, long) usage. I had placed it intentionally there, as requested by @dfuch, for FileChannel can have custom implementations, and we better communicate what FC method we use under the hood and with which assumptions.
>
> I felt that as long as we convey that the `FileChannel's` position isn't altered by the method, then it should be enough for the specification of the API, without having to explain which method the implementation uses. But I'll let Daniel suggest which one he prefers.
>
>> Regarding the _"the size of the {@code channel}"_ expression, maybe a little bit grammar policing, but a channel doesn't have a size, instead, the file referred by the channel has a size – `FC::size` Javadoc is worded in this way too.
>
> I think it can be worded something like:
>
>> @throws IOException if the {@linkplain FileChannel#size() channel's size} cannot be determined or the {@code channel} is closed
In 84d14fc0, improved the `ofFileChannel` Javadoc as suggested by @jaikiran – did not include the mention of `FC::read` used under the hood.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/26155#issuecomment-3201212175
More information about the net-dev
mailing list