2003-03-10 Michael Koch <konqueror@gmx.de>
authorMichael Koch <konqueror@gmx.de>
Mon, 10 Mar 2003 15:31:03 +0000 (15:31 +0000)
committerMichael Koch <mkoch@gcc.gnu.org>
Mon, 10 Mar 2003 15:31:03 +0000 (15:31 +0000)
* java/nio/ByteOrder.java
(nativeOrder): Working implementation, added documentation.
(toString): Added documentation.

From-SVN: r64085

libjava/ChangeLog
libjava/java/nio/ByteOrder.java

index f744cf9c5d8e8b465ff789df015908ae51847dc9..dd1836ee7daf2a6176bf7e9befc1189c9d043033 100644 (file)
@@ -1,3 +1,9 @@
+2003-03-10  Michael Koch  <konqueror@gmx.de>
+
+       * java/nio/ByteOrder.java
+       (nativeOrder): Working implementation, added documentation.
+       (toString): Added documentation.
+
 2003-03-10  Michael Koch  <konqueror@gmx.de>
 
        * java/net/DatagramSocket.java,
index 010fa29d0b696ef2a6a25db5f3510e22444ed1f4..f1001a33b71cc1de97cdace8772746e73bdafce8 100644 (file)
@@ -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";