RFR: 8293971: Loading new Media from resources can sometimes fail when loading from FXML

Andy Goryachev angorya at openjdk.org
Mon Sep 26 23:12:17 UTC 2022


On Mon, 26 Sep 2022 22:57:37 GMT, Alexander Matveev <almatvee at openjdk.org> wrote:

>> modules/javafx.media/src/main/java/com/sun/media/jfxmediaimpl/MediaUtils.java line 154:
>> 
>>> 152:         } else if ((buf[0] & 0xff) == 0xff && (buf[1] & 0xe0) == 0xe0 && // sync
>>> 153:                 (buf[1] & 0x18) != 0x08 && // not reserved version
>>> 154:                 (buf[1] & 0x06) != 0x00) { // not reserved layer
>> 
>> thank you for providing a descriptive comment!
>> 
>> I wonder if, in the future, when the list of supported formats grows, we ought to invent some kind of Bit(input)Stream class that would make operating on bit fields easier?
>
> I think we can use java.util.BitSet. We can define BitSet for headers and then use intersects to see if bits are set, but it will be out of scope for this issue.

No, not a BitSet.  
Something along the lines of
https://github.com/andy-goryachev/PasswordSafe/blob/master/src/goryachev/common/io/BitStreamReader.java

just a suggestion, no change in this PR is requested.

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

PR: https://git.openjdk.org/jfx/pull/902


More information about the openjfx-dev mailing list