ByteBufferAsFloatBuffer: Merged variants

Merged big endian, little endian and readonly variant of the class
and corrected few following dependent changes.

Change-Id: Id984efb795c47a67168086b4084696a93cd0b42e
diff --git a/ojluni/src/main/java/java/nio/ByteBufferAsFloatBuffer.java b/ojluni/src/main/java/java/nio/ByteBufferAsFloatBuffer.java
new file mode 100644
index 0000000..04277a1
--- /dev/null
+++ b/ojluni/src/main/java/java/nio/ByteBufferAsFloatBuffer.java
@@ -0,0 +1,177 @@
+/*
+ * Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package java.nio;
+
+class ByteBufferAsFloatBuffer extends FloatBuffer {       // package-private
+
+    protected final ByteBuffer bb;
+    protected final int offset;
+    private final boolean isReadOnly;
+    private final ByteOrder order;
+
+    ByteBufferAsFloatBuffer(ByteBuffer bb, ByteOrder order) {
+        this(bb, order, false);
+    }
+
+    ByteBufferAsFloatBuffer(ByteBuffer bb, ByteOrder order, boolean isReadOnly) {   // package-private
+        super(-1, 0,
+
+              bb.remaining() >> 2,
+              bb.remaining() >> 2);
+        this.bb = bb;
+        this.order = order;
+        this.isReadOnly = isReadOnly;
+        int cap = this.capacity();
+        this.limit(cap);
+        int pos = this.position();
+        assert (pos <= cap);
+        offset = pos;
+    }
+
+    ByteBufferAsFloatBuffer(ByteBuffer bb,
+                            int mark, int pos, int lim, int cap,
+                            int off, ByteOrder order) {
+        this(bb, mark, pos, lim, cap, off, order, false);
+    }
+
+    ByteBufferAsFloatBuffer(ByteBuffer bb,
+                            int mark, int pos, int lim, int cap,
+                            int off, ByteOrder order, boolean isReadOnly) {
+        super(mark, pos, lim, cap);
+        this.bb = bb;
+        this.order = order;
+        this.isReadOnly = isReadOnly;
+        offset = off;
+    }
+
+    public FloatBuffer slice() {
+        int pos = this.position();
+        int lim = this.limit();
+        assert (pos <= lim);
+        int rem = (pos <= lim ? lim - pos : 0);
+        int off = (pos << 2) + offset;
+        assert (off >= 0);
+        return new ByteBufferAsFloatBuffer(bb, -1, 0, rem, rem, off, order, isReadOnly);
+    }
+
+    public FloatBuffer duplicate() {
+        return new ByteBufferAsFloatBuffer(bb,
+                                           this.markValue(),
+                                           this.position(),
+                                           this.limit(),
+                                           this.capacity(),
+                                           offset,
+                                           order,
+                                           isReadOnly);
+    }
+
+    public FloatBuffer asReadOnlyBuffer() {
+        return new ByteBufferAsFloatBuffer(bb,
+                                           this.markValue(),
+                                           this.position(),
+                                           this.limit(),
+                                           this.capacity(),
+                                           offset,
+                                           order,
+                                           true);
+    }
+
+    protected int ix(int i) {
+        return (i << 2) + offset;
+    }
+
+    public float get() {
+        if (order == ByteOrder.LITTLE_ENDIAN) {
+            return Bits.getFloatL(bb, ix(nextGetIndex()));
+        } else {
+            return Bits.getFloatB(bb, ix(nextGetIndex()));
+        }
+    }
+
+    public float get(int i) {
+        if (order == ByteOrder.LITTLE_ENDIAN) {
+            return Bits.getFloatL(bb, ix(checkIndex(i)));
+        } else {
+            return Bits.getFloatB(bb, ix(checkIndex(i)));
+        }
+    }
+
+    public FloatBuffer put(float x) {
+        if (isReadOnly) {
+            throw new ReadOnlyBufferException();
+        }
+        if (order == ByteOrder.LITTLE_ENDIAN) {
+            Bits.putFloatL(bb, ix(nextPutIndex()), x);
+        } else {
+            Bits.putFloatB(bb, ix(nextPutIndex()), x);
+        }
+        return this;
+    }
+
+    public FloatBuffer put(int i, float x) {
+        if (isReadOnly) {
+            throw new ReadOnlyBufferException();
+        }
+        if (order == ByteOrder.LITTLE_ENDIAN) {
+            Bits.putFloatL(bb, ix(checkIndex(i)), x);
+        } else {
+            Bits.putFloatB(bb, ix(checkIndex(i)), x);
+        }
+        return this;
+    }
+
+    public FloatBuffer compact() {
+        if (isReadOnly) {
+            throw new ReadOnlyBufferException();
+        }
+        int pos = position();
+        int lim = limit();
+        assert (pos <= lim);
+        int rem = (pos <= lim ? lim - pos : 0);
+        ByteBuffer db = bb.duplicate();
+        db.limit(ix(lim));
+        db.position(ix(0));
+        ByteBuffer sb = db.slice();
+        sb.position(pos << 2);
+        sb.compact();
+        position(rem);
+        limit(capacity());
+        discardMark();
+        return this;
+    }
+
+    public boolean isDirect() {
+        return bb.isDirect();
+    }
+
+    public boolean isReadOnly() {
+        return isReadOnly;
+    }
+
+    public ByteOrder order() {
+        return order;
+    }
+}
diff --git a/ojluni/src/main/java/java/nio/ByteBufferAsFloatBufferB.java b/ojluni/src/main/java/java/nio/ByteBufferAsFloatBufferB.java
deleted file mode 100644
index 277d4b8..0000000
--- a/ojluni/src/main/java/java/nio/ByteBufferAsFloatBufferB.java
+++ /dev/null
@@ -1,219 +0,0 @@
-/*
- * Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-// -- This file was mechanically generated: Do not edit! -- //
-
-package java.nio;
-
-
-class ByteBufferAsFloatBufferB                  // package-private
-    extends FloatBuffer
-{
-
-
-
-    protected final ByteBuffer bb;
-    protected final int offset;
-
-
-
-    ByteBufferAsFloatBufferB(ByteBuffer bb) {   // package-private
-
-        super(-1, 0,
-              bb.remaining() >> 2,
-              bb.remaining() >> 2);
-        this.bb = bb;
-        // enforce limit == capacity
-        int cap = this.capacity();
-        this.limit(cap);
-        int pos = this.position();
-        assert (pos <= cap);
-        offset = pos;
-
-
-
-    }
-
-    ByteBufferAsFloatBufferB(ByteBuffer bb,
-                                     int mark, int pos, int lim, int cap,
-                                     int off)
-    {
-
-        super(mark, pos, lim, cap);
-        this.bb = bb;
-        offset = off;
-
-
-
-    }
-
-    public FloatBuffer slice() {
-        int pos = this.position();
-        int lim = this.limit();
-        assert (pos <= lim);
-        int rem = (pos <= lim ? lim - pos : 0);
-        int off = (pos << 2) + offset;
-        assert (off >= 0);
-        return new ByteBufferAsFloatBufferB(bb, -1, 0, rem, rem, off);
-    }
-
-    public FloatBuffer duplicate() {
-        return new ByteBufferAsFloatBufferB(bb,
-                                                    this.markValue(),
-                                                    this.position(),
-                                                    this.limit(),
-                                                    this.capacity(),
-                                                    offset);
-    }
-
-    public FloatBuffer asReadOnlyBuffer() {
-
-        return new ByteBufferAsFloatBufferRB(bb,
-                                                 this.markValue(),
-                                                 this.position(),
-                                                 this.limit(),
-                                                 this.capacity(),
-                                                 offset);
-
-
-
-    }
-
-
-
-    protected int ix(int i) {
-        return (i << 2) + offset;
-    }
-
-    public float get() {
-        return Bits.getFloatB(bb, ix(nextGetIndex()));
-    }
-
-    public float get(int i) {
-        return Bits.getFloatB(bb, ix(checkIndex(i)));
-    }
-
-
-
-    public FloatBuffer put(float x) {
-
-        Bits.putFloatB(bb, ix(nextPutIndex()), x);
-        return this;
-
-
-
-    }
-
-    public FloatBuffer put(int i, float x) {
-
-        Bits.putFloatB(bb, ix(checkIndex(i)), x);
-        return this;
-
-
-
-    }
-
-    public FloatBuffer compact() {
-
-        int pos = position();
-        int lim = limit();
-        assert (pos <= lim);
-        int rem = (pos <= lim ? lim - pos : 0);
-
-        ByteBuffer db = bb.duplicate();
-        db.limit(ix(lim));
-        db.position(ix(0));
-        ByteBuffer sb = db.slice();
-        sb.position(pos << 2);
-        sb.compact();
-        position(rem);
-        limit(capacity());
-        discardMark();
-        return this;
-
-
-
-    }
-
-    public boolean isDirect() {
-        return bb.isDirect();
-    }
-
-    public boolean isReadOnly() {
-        return false;
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-    public ByteOrder order() {
-
-        return ByteOrder.BIG_ENDIAN;
-
-
-
-
-    }
-
-}
diff --git a/ojluni/src/main/java/java/nio/ByteBufferAsFloatBufferL.java b/ojluni/src/main/java/java/nio/ByteBufferAsFloatBufferL.java
deleted file mode 100644
index ffca4c0..0000000
--- a/ojluni/src/main/java/java/nio/ByteBufferAsFloatBufferL.java
+++ /dev/null
@@ -1,219 +0,0 @@
-/*
- * Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-// -- This file was mechanically generated: Do not edit! -- //
-
-package java.nio;
-
-
-class ByteBufferAsFloatBufferL                  // package-private
-    extends FloatBuffer
-{
-
-
-
-    protected final ByteBuffer bb;
-    protected final int offset;
-
-
-
-    ByteBufferAsFloatBufferL(ByteBuffer bb) {   // package-private
-
-        super(-1, 0,
-              bb.remaining() >> 2,
-              bb.remaining() >> 2);
-        this.bb = bb;
-        // enforce limit == capacity
-        int cap = this.capacity();
-        this.limit(cap);
-        int pos = this.position();
-        assert (pos <= cap);
-        offset = pos;
-
-
-
-    }
-
-    ByteBufferAsFloatBufferL(ByteBuffer bb,
-                                     int mark, int pos, int lim, int cap,
-                                     int off)
-    {
-
-        super(mark, pos, lim, cap);
-        this.bb = bb;
-        offset = off;
-
-
-
-    }
-
-    public FloatBuffer slice() {
-        int pos = this.position();
-        int lim = this.limit();
-        assert (pos <= lim);
-        int rem = (pos <= lim ? lim - pos : 0);
-        int off = (pos << 2) + offset;
-        assert (off >= 0);
-        return new ByteBufferAsFloatBufferL(bb, -1, 0, rem, rem, off);
-    }
-
-    public FloatBuffer duplicate() {
-        return new ByteBufferAsFloatBufferL(bb,
-                                                    this.markValue(),
-                                                    this.position(),
-                                                    this.limit(),
-                                                    this.capacity(),
-                                                    offset);
-    }
-
-    public FloatBuffer asReadOnlyBuffer() {
-
-        return new ByteBufferAsFloatBufferRL(bb,
-                                                 this.markValue(),
-                                                 this.position(),
-                                                 this.limit(),
-                                                 this.capacity(),
-                                                 offset);
-
-
-
-    }
-
-
-
-    protected int ix(int i) {
-        return (i << 2) + offset;
-    }
-
-    public float get() {
-        return Bits.getFloatL(bb, ix(nextGetIndex()));
-    }
-
-    public float get(int i) {
-        return Bits.getFloatL(bb, ix(checkIndex(i)));
-    }
-
-
-
-    public FloatBuffer put(float x) {
-
-        Bits.putFloatL(bb, ix(nextPutIndex()), x);
-        return this;
-
-
-
-    }
-
-    public FloatBuffer put(int i, float x) {
-
-        Bits.putFloatL(bb, ix(checkIndex(i)), x);
-        return this;
-
-
-
-    }
-
-    public FloatBuffer compact() {
-
-        int pos = position();
-        int lim = limit();
-        assert (pos <= lim);
-        int rem = (pos <= lim ? lim - pos : 0);
-
-        ByteBuffer db = bb.duplicate();
-        db.limit(ix(lim));
-        db.position(ix(0));
-        ByteBuffer sb = db.slice();
-        sb.position(pos << 2);
-        sb.compact();
-        position(rem);
-        limit(capacity());
-        discardMark();
-        return this;
-
-
-
-    }
-
-    public boolean isDirect() {
-        return bb.isDirect();
-    }
-
-    public boolean isReadOnly() {
-        return false;
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-    public ByteOrder order() {
-
-
-
-
-        return ByteOrder.LITTLE_ENDIAN;
-
-    }
-
-}
diff --git a/ojluni/src/main/java/java/nio/ByteBufferAsFloatBufferRB.java b/ojluni/src/main/java/java/nio/ByteBufferAsFloatBufferRB.java
deleted file mode 100644
index bd07180..0000000
--- a/ojluni/src/main/java/java/nio/ByteBufferAsFloatBufferRB.java
+++ /dev/null
@@ -1,219 +0,0 @@
-/*
- * Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-// -- This file was mechanically generated: Do not edit! -- //
-
-package java.nio;
-
-
-class ByteBufferAsFloatBufferRB                  // package-private
-    extends ByteBufferAsFloatBufferB
-{
-
-
-
-
-
-
-
-
-    ByteBufferAsFloatBufferRB(ByteBuffer bb) {   // package-private
-
-
-
-
-
-
-
-
-
-
-
-
-        super(bb);
-
-    }
-
-    ByteBufferAsFloatBufferRB(ByteBuffer bb,
-                                     int mark, int pos, int lim, int cap,
-                                     int off)
-    {
-
-
-
-
-
-        super(bb, mark, pos, lim, cap, off);
-
-    }
-
-    public FloatBuffer slice() {
-        int pos = this.position();
-        int lim = this.limit();
-        assert (pos <= lim);
-        int rem = (pos <= lim ? lim - pos : 0);
-        int off = (pos << 2) + offset;
-        assert (off >= 0);
-        return new ByteBufferAsFloatBufferRB(bb, -1, 0, rem, rem, off);
-    }
-
-    public FloatBuffer duplicate() {
-        return new ByteBufferAsFloatBufferRB(bb,
-                                                    this.markValue(),
-                                                    this.position(),
-                                                    this.limit(),
-                                                    this.capacity(),
-                                                    offset);
-    }
-
-    public FloatBuffer asReadOnlyBuffer() {
-
-
-
-
-
-
-
-
-        return duplicate();
-
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-    public FloatBuffer put(float x) {
-
-
-
-
-        throw new ReadOnlyBufferException();
-
-    }
-
-    public FloatBuffer put(int i, float x) {
-
-
-
-
-        throw new ReadOnlyBufferException();
-
-    }
-
-    public FloatBuffer compact() {
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-        throw new ReadOnlyBufferException();
-
-    }
-
-    public boolean isDirect() {
-        return bb.isDirect();
-    }
-
-    public boolean isReadOnly() {
-        return true;
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-    public ByteOrder order() {
-
-        return ByteOrder.BIG_ENDIAN;
-
-
-
-
-    }
-
-}
diff --git a/ojluni/src/main/java/java/nio/ByteBufferAsFloatBufferRL.java b/ojluni/src/main/java/java/nio/ByteBufferAsFloatBufferRL.java
deleted file mode 100644
index 387c3ac..0000000
--- a/ojluni/src/main/java/java/nio/ByteBufferAsFloatBufferRL.java
+++ /dev/null
@@ -1,219 +0,0 @@
-/*
- * Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-// -- This file was mechanically generated: Do not edit! -- //
-
-package java.nio;
-
-
-class ByteBufferAsFloatBufferRL                  // package-private
-    extends ByteBufferAsFloatBufferL
-{
-
-
-
-
-
-
-
-
-    ByteBufferAsFloatBufferRL(ByteBuffer bb) {   // package-private
-
-
-
-
-
-
-
-
-
-
-
-
-        super(bb);
-
-    }
-
-    ByteBufferAsFloatBufferRL(ByteBuffer bb,
-                                     int mark, int pos, int lim, int cap,
-                                     int off)
-    {
-
-
-
-
-
-        super(bb, mark, pos, lim, cap, off);
-
-    }
-
-    public FloatBuffer slice() {
-        int pos = this.position();
-        int lim = this.limit();
-        assert (pos <= lim);
-        int rem = (pos <= lim ? lim - pos : 0);
-        int off = (pos << 2) + offset;
-        assert (off >= 0);
-        return new ByteBufferAsFloatBufferRL(bb, -1, 0, rem, rem, off);
-    }
-
-    public FloatBuffer duplicate() {
-        return new ByteBufferAsFloatBufferRL(bb,
-                                                    this.markValue(),
-                                                    this.position(),
-                                                    this.limit(),
-                                                    this.capacity(),
-                                                    offset);
-    }
-
-    public FloatBuffer asReadOnlyBuffer() {
-
-
-
-
-
-
-
-
-        return duplicate();
-
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-    public FloatBuffer put(float x) {
-
-
-
-
-        throw new ReadOnlyBufferException();
-
-    }
-
-    public FloatBuffer put(int i, float x) {
-
-
-
-
-        throw new ReadOnlyBufferException();
-
-    }
-
-    public FloatBuffer compact() {
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-        throw new ReadOnlyBufferException();
-
-    }
-
-    public boolean isDirect() {
-        return bb.isDirect();
-    }
-
-    public boolean isReadOnly() {
-        return true;
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-    public ByteOrder order() {
-
-
-
-
-        return ByteOrder.LITTLE_ENDIAN;
-
-    }
-
-}
diff --git a/ojluni/src/main/java/java/nio/DirectByteBuffer.java b/ojluni/src/main/java/java/nio/DirectByteBuffer.java
index 2ba2be5..4705cac 100644
--- a/ojluni/src/main/java/java/nio/DirectByteBuffer.java
+++ b/ojluni/src/main/java/java/nio/DirectByteBuffer.java
@@ -895,19 +895,14 @@
 
         int size = rem >> 2;
         if (!unaligned() && ((address + off) % (1 << 2) != 0)) {
-            return (bigEndian
-                    ? (FloatBuffer)(new ByteBufferAsFloatBufferB(this,
-                                                                 -1,
-                                                                 0,
-                                                                 size,
-                                                                 size,
-                                                                 off))
-                    : (FloatBuffer)(new ByteBufferAsFloatBufferL(this,
-                                                                 -1,
-                                                                 0,
-                                                                 size,
-                                                                 size,
-                                                                 off)));
+            return (FloatBuffer)(new ByteBufferAsFloatBuffer(this,
+                                                             -1,
+                                                             0,
+                                                             size,
+                                                             size,
+                                                             off,
+                                                             order(),
+                                                             false));
         } else {
             return (nativeByteOrder
                     ? (FloatBuffer)(new DirectFloatBufferU(this,
diff --git a/ojluni/src/main/java/java/nio/DirectByteBufferR.java b/ojluni/src/main/java/java/nio/DirectByteBufferR.java
index 473f473..464a724 100644
--- a/ojluni/src/main/java/java/nio/DirectByteBufferR.java
+++ b/ojluni/src/main/java/java/nio/DirectByteBufferR.java
@@ -884,19 +884,14 @@
 
         int size = rem >> 2;
         if (!unaligned() && ((address + off) % (1 << 2) != 0)) {
-            return (bigEndian
-                    ? (FloatBuffer)(new ByteBufferAsFloatBufferRB(this,
-                                                                  -1,
-                                                                  0,
-                                                                  size,
-                                                                  size,
-                                                                  off))
-                    : (FloatBuffer)(new ByteBufferAsFloatBufferRL(this,
-                                                                  -1,
-                                                                  0,
-                                                                  size,
-                                                                  size,
-                                                                  off)));
+            return (FloatBuffer)(new ByteBufferAsFloatBuffer(this,
+                                                             -1,
+                                                             0,
+                                                             size,
+                                                             size,
+                                                             off,
+                                                             order(),
+                                                             true));
         } else {
             return (nativeByteOrder
                     ? (FloatBuffer)(new DirectFloatBufferRU(this,
diff --git a/ojluni/src/main/java/java/nio/HeapByteBuffer.java b/ojluni/src/main/java/java/nio/HeapByteBuffer.java
index 8f7d6f8..f1e6150 100644
--- a/ojluni/src/main/java/java/nio/HeapByteBuffer.java
+++ b/ojluni/src/main/java/java/nio/HeapByteBuffer.java
@@ -412,35 +412,14 @@
     public FloatBuffer asFloatBuffer() {
         int size = this.remaining() >> 2;
         int off = offset + position();
-        if (isReadOnly) {
-            return (bigEndian
-                    ? (FloatBuffer)(new ByteBufferAsFloatBufferRB(this,
-                                                                  -1,
-                                                                  0,
-                                                                  size,
-                                                                  size,
-                                                                  off))
-                    : (FloatBuffer)(new ByteBufferAsFloatBufferRL(this,
-                                                                  -1,
-                                                                  0,
-                                                                  size,
-                                                                  size,
-                                                                  off)));
-        } else {
-            return (bigEndian
-                    ? (FloatBuffer)(new ByteBufferAsFloatBufferB(this,
-                                                                 -1,
-                                                                 0,
-                                                                 size,
-                                                                 size,
-                                                                 off))
-                    : (FloatBuffer)(new ByteBufferAsFloatBufferL(this,
-                                                                 -1,
-                                                                 0,
-                                                                 size,
-                                                                 size,
-                                                                 off)));
-        }
+        return (FloatBuffer)(new ByteBufferAsFloatBuffer(this,
+                                                         -1,
+                                                         0,
+                                                         size,
+                                                         size,
+                                                         off,
+                                                         order(),
+                                                         isReadOnly));
     }
 
     public double getDouble() {
diff --git a/openjdk_java_files.mk b/openjdk_java_files.mk
index 5093ad5..ff92377 100644
--- a/openjdk_java_files.mk
+++ b/openjdk_java_files.mk
@@ -323,10 +323,7 @@
     ojluni/src/main/java/java/nio/ByteBufferAsCharBufferRB.java \
     ojluni/src/main/java/java/nio/ByteBufferAsCharBufferRL.java \
     ojluni/src/main/java/java/nio/ByteBufferAsDoubleBuffer.java \
-    ojluni/src/main/java/java/nio/ByteBufferAsFloatBufferB.java \
-    ojluni/src/main/java/java/nio/ByteBufferAsFloatBufferL.java \
-    ojluni/src/main/java/java/nio/ByteBufferAsFloatBufferRB.java \
-    ojluni/src/main/java/java/nio/ByteBufferAsFloatBufferRL.java \
+    ojluni/src/main/java/java/nio/ByteBufferAsFloatBuffer.java \
     ojluni/src/main/java/java/nio/ByteBufferAsIntBuffer.java \
     ojluni/src/main/java/java/nio/ByteBufferAsLongBuffer.java \
     ojluni/src/main/java/java/nio/ByteBufferAsShortBuffer.java \