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

Jaikiran Pai jpai at openjdk.org
Tue Aug 19 15:37:43 UTC 2025


On Tue, 19 Aug 2025 09:25:28 GMT, Daniel Fuchs <dfuchs at openjdk.org> wrote:

> I'm not sure saying "this method doesn't change the channel position" is appropriate - indeed it's not the method that would potentially change the channel position but the body publisher it returns.

That's a good point. I had overlooked the part that the method implementation merely returns a BodyPublisher which then uses the FileChannel. So perhaps we should say:


This method and the returned {@code BodyPublisher} do not modify the {@code channel}'s position.



> Also - though uploading non-overlapping portions of the file is how you would usually use the publisher, it is not required that the portions are non-overlapping for concurrency to work correctly.

Right. The mention about non-overlapping was more to suggest that an entire file can be split into smaller independent parts as part of the upload. But yes, as you note, it's not mandatory and using overlapping portions too does support concurrent usage of the FileChannel. That mention can be removed if it creates confusion.

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

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


More information about the net-dev mailing list