Package java.nio

Class ByteOrder


  • public final class ByteOrder
    extends Object
    Defines byte order constants.
    • Field Detail

      • BIG_ENDIAN

        public static final ByteOrder BIG_ENDIAN
        This constant represents big endian.
      • LITTLE_ENDIAN

        public static final ByteOrder LITTLE_ENDIAN
        This constant represents little endian.
      • needsSwap

        public final boolean needsSwap
        This is the only thing that ByteOrder is really used for: to know whether we need to swap bytes to get this order, given bytes in native order. (That is, this is the opposite of the hypothetical "isNativeOrder".)
    • Method Detail

      • nativeOrder

        public static ByteOrder nativeOrder()
        Returns the current platform byte order.
        Returns:
        the byte order object, which is either LITTLE_ENDIAN or BIG_ENDIAN.