Package java.nio
Class ByteOrder
java.lang.Object
java.nio.ByteOrder
public final class ByteOrder extends Object
Defines byte order constants.
-
Field Summary
Fields Modifier and Type Field Description static ByteOrderBIG_ENDIANThis constant represents big endian.static ByteOrderLITTLE_ENDIANThis constant represents little endian.booleanneedsSwapThis 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. -
Method Summary
Modifier and Type Method Description static ByteOrdernativeOrder()Returns the current platform byte order.StringtoString()Returns a string that describes this object.
-
Field Details
-
BIG_ENDIAN
This constant represents big endian. -
LITTLE_ENDIAN
This constant represents little endian. -
needsSwap
public final boolean needsSwapThis 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 Details
-
nativeOrder
Returns the current platform byte order.- Returns:
- the byte order object, which is either LITTLE_ENDIAN or BIG_ENDIAN.
-
toString
Returns a string that describes this object.- Overrides:
toStringin classObject- Returns:
- "BIG_ENDIAN" for
ByteOrder.BIG_ENDIANobjects, "LITTLE_ENDIAN" forByteOrder.LITTLE_ENDIANobjects.
-