diff options
author | Michael Koch <konqueror@gmx.de> | 2003-03-10 15:31:03 +0000 |
---|---|---|
committer | Michael Koch <mkoch@gcc.gnu.org> | 2003-03-10 15:31:03 +0000 |
commit | 2e65e47e263040a141c87c75e6fb143df209b33a (patch) | |
tree | 9868fae96edb4221488bb650339afe5d70cf0eb8 /libjava/java | |
parent | 7507403ae5105364c0e51a0d385efb428a5a0782 (diff) | |
download | gcc-2e65e47e263040a141c87c75e6fb143df209b33a.zip gcc-2e65e47e263040a141c87c75e6fb143df209b33a.tar.gz gcc-2e65e47e263040a141c87c75e6fb143df209b33a.tar.bz2 |
2003-03-10 Michael Koch <konqueror@gmx.de>
* java/nio/ByteOrder.java
(nativeOrder): Working implementation, added documentation.
(toString): Added documentation.
From-SVN: r64085
Diffstat (limited to 'libjava/java')
-rw-r--r-- | libjava/java/nio/ByteOrder.java | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/libjava/java/nio/ByteOrder.java b/libjava/java/nio/ByteOrder.java index 010fa29..f1001a3 100644 --- a/libjava/java/nio/ByteOrder.java +++ b/libjava/java/nio/ByteOrder.java @@ -35,19 +35,30 @@ this exception to your version of the library, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. */ -package java.nio; +package java.nio; +/** + * @author Michael Koch + * @since 1.4 + */ public final class ByteOrder { public static final ByteOrder BIG_ENDIAN = new ByteOrder(); public static final ByteOrder LITTLE_ENDIAN = new ByteOrder(); - public static ByteOrder nativeOrder() + /** + * Returns the native byte order of the platform currently running. + */ + public static ByteOrder nativeOrder () { - return BIG_ENDIAN; + return (System.getProperty ("gnu.cpu.endian") == "big" + ? BIG_ENDIAN : LITTLE_ENDIAN); } + /** + * Returns a string representation of the byte order. + */ public String toString() { return this == BIG_ENDIAN ? "BIG_ENDIAN" : "LITTLE_ENDIAN"; |