38 |
package java.nio; |
package java.nio; |
39 |
|
|
40 |
|
|
41 |
public class ByteOrder |
public final class ByteOrder |
42 |
{ |
{ |
43 |
final static ByteOrder BIG_ENDIAN = new ByteOrder(); |
static final ByteOrder BIG_ENDIAN = new ByteOrder(); |
44 |
final static ByteOrder LITTLE_ENDIAN = new ByteOrder(); |
static final ByteOrder LITTLE_ENDIAN = new ByteOrder(); |
45 |
|
|
46 |
static ByteOrder nativeOrder() |
public static ByteOrder nativeOrder() |
47 |
{ |
{ |
48 |
return BIG_ENDIAN; |
return BIG_ENDIAN; |
49 |
} |
} |
50 |
|
|
51 |
public String toString() |
public String toString() |
52 |
{ |
{ |
53 |
if (this == BIG_ENDIAN) |
return this == BIG_ENDIAN ? "BIG_ENDIAN" : "LITTLE_ENDIAN"; |
54 |
{ |
} |
55 |
return "big endian"; |
|
56 |
} |
// This class can only be instantiated here. |
57 |
else |
private ByteOrder () |
58 |
{ |
{ |
59 |
return "little endian"; |
} |
|
} |
|
|
} |
|
|
|
|
60 |
} |
} |