RFR: 8329829: HttpClient: Add a BodyPublishers.ofFileChannel method [v8]

Jaikiran Pai jpai at openjdk.org
Tue Aug 19 09:20:40 UTC 2025


On Mon, 18 Aug 2025 15:12:19 GMT, Daniel Fuchs <dfuchs at openjdk.org> wrote:

>> Volkan Yazici has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Improve style for declaring multiple consecutive fields of the same type
>
> 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

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

PR Comment: https://git.openjdk.org/jdk/pull/26155#issuecomment-3199936910


More information about the net-dev mailing list