RFR: 8361286: Allow enabling of background loading for images loaded from an InputStream [v4]
Michael Strauß
mstrauss at openjdk.org
Thu Aug 21 18:36:07 UTC 2025
On Wed, 20 Aug 2025 23:33:16 GMT, John Hendrikx <jhendrikx at openjdk.org> wrote:
>> Support background loading of raw input streams
>>
>> - Fixed generics (mix up of two ImageLoader types)
>> - Removed unused code for handling headers, methods, request parameters
>> - Use `long` for progress as streams may exceed 2 GB
>> - Improved documentation of Image regarding background loading
>
> John Hendrikx has updated the pull request incrementally with one additional commit since the last revision:
>
> Fix typo
A new parameter to toggle whether the stream will be closed should have at least a moderately strong use case to justify its existence. I can't think of any. If you turn over a stream to an asynchronous process, you effectively relinquish ownership of that stream, as you don't know when (if ever) it will be processed.
But even then, you can very easily achieve the non-closing behavior without new JavaFX API, just by using existing stream APIs:
var streamThatWillNotCloseUnderlyingStream = new FilterInputStream(myStream) {
@Override
public void close() {
// don't call super.close(), so underlying stream won't be closed
}
}
-------------
PR Comment: https://git.openjdk.org/jfx/pull/1875#issuecomment-3211676264
More information about the openjfx-dev
mailing list