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

Phil Race prr at openjdk.org
Thu Jan 8 20:01:01 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.

src/java.desktop/share/classes/com/sun/media/sound/Platform.java line 63:

> 61:      */
> 62:     static boolean isBigEndian() {
> 63:         if (java.nio.ByteOrder.nativeOrder().equals(java.nio.ByteOrder.BIG_ENDIAN)) {

stylistically, this would look better as a single line

return java.nio.ByteOrder.nativeOrder().equals(java.nio.ByteOrder.BIG_ENDIAN);

or

return java.nio.ByteOrder.BIG_ENDIAN.equals( java.nio.ByteOrder.nativeOrder());

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

PR Review Comment: https://git.openjdk.org/jdk/pull/29113#discussion_r2673689753


More information about the client-libs-dev mailing list