RFR: 8374727: Audio configuration Platform class - use nio for getting endianness of the underlying platform

Matthias Baesken mbaesken at openjdk.org
Thu Jan 8 13:04:44 UTC 2026


On Thu, 8 Jan 2026 10:13:54 GMT, Matthias Baesken <mbaesken at openjdk.org> wrote:

> Currently Platform.java from the audio coding uses its own native code to get the endianness info of the underlying hardware it runs on.
> See https://github.com/openjdk/jdk/blob/da14813a5bdadaf0a1f81fa57ff6e1b103eaf113/src/java.desktop/share/classes/com/sun/media/sound/Platform.java#L86
> But we can reuse existing Java JDK code e.g. from nio.

`ByteOrder.nativeOrder()`  is already used for the BE/LE checks across the JDK, see
https://github.com/search?q=repo%3Aopenjdk%2Fjdk++%22ByteOrder.nativeOrder%28%29+%3D%3D%22&type=code

(maybe we should also have something like `public static boolean ByteOrder.isLittleEndian() `/  `public static boolean ByteOrder.isBigEndian()`  to shorten those checks a bit, but this is out of the scope of this PR)

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

PR Comment: https://git.openjdk.org/jdk/pull/29113#issuecomment-3723781253


More information about the client-libs-dev mailing list