@@ -1002,7 +1002,7 @@ public int unsignedByteAt(int index) {
10021002 */
10031003 public char charAt (int index ) {
10041004 Util .checkIndexBounds (length (), index , 2 , "char" );
1005- return ByteBuffer .wrap (internalArray ()).order (byteOrder ).position (index ).getChar ();
1005+ return (( ByteBuffer ) ByteBuffer .wrap (internalArray ()).order (byteOrder ).position (index ) ).getChar ();
10061006 }
10071007
10081008 /**
@@ -1015,7 +1015,7 @@ public char charAt(int index) {
10151015 */
10161016 public short shortAt (int index ) {
10171017 Util .checkIndexBounds (length (), index , 2 , "short" );
1018- return ByteBuffer .wrap (internalArray ()).order (byteOrder ).position (index ).getShort ();
1018+ return (( ByteBuffer ) ByteBuffer .wrap (internalArray ()).order (byteOrder ).position (index ) ).getShort ();
10191019 }
10201020
10211021 /**
@@ -1028,7 +1028,7 @@ public short shortAt(int index) {
10281028 */
10291029 public int intAt (int index ) {
10301030 Util .checkIndexBounds (length (), index , 4 , "int" );
1031- return ByteBuffer .wrap (internalArray ()).order (byteOrder ).position (index ).getInt ();
1031+ return (( ByteBuffer ) ByteBuffer .wrap (internalArray ()).order (byteOrder ).position (index ) ).getInt ();
10321032 }
10331033
10341034 /**
@@ -1041,7 +1041,7 @@ public int intAt(int index) {
10411041 */
10421042 public long longAt (int index ) {
10431043 Util .checkIndexBounds (length (), index , 8 , "long" );
1044- return ByteBuffer .wrap (internalArray ()).order (byteOrder ).position (index ).getLong ();
1044+ return (( ByteBuffer ) ByteBuffer .wrap (internalArray ()).order (byteOrder ).position (index ) ).getLong ();
10451045 }
10461046
10471047 /**
@@ -1077,7 +1077,7 @@ public double entropy() {
10771077 return new Util .Entropy <>(toList ()).entropy ();
10781078 }
10791079
1080- /* CONSERVATORS POSSIBLY REUSING THE INTERNAL ARRAY ***************************************************************/
1080+ /* CONVERTERS POSSIBLY REUSING THE INTERNAL ARRAY ***************************************************************/
10811081
10821082 /**
10831083 * Create a new instance which shares the same underlying array
@@ -1517,13 +1517,14 @@ public boolean equals(Byte[] anotherArray) {
15171517 }
15181518
15191519 /**
1520- * Compares the inner array with the inner array of given ByteBuffer
1520+ * Compares the inner array with the inner array of given ByteBuffer.
1521+ * Will check for internal array and byte order.
15211522 *
15221523 * @param buffer to compare with
15231524 * @return true if both array have same length and every byte element is the same
15241525 */
15251526 public boolean equals (ByteBuffer buffer ) {
1526- return buffer != null && Arrays . equals ( internalArray (), buffer . array () );
1527+ return buffer != null && byteOrder == buffer . order () && ByteBuffer . wrap ( internalArray ()). order ( byteOrder ). equals ( buffer );
15271528 }
15281529
15291530 /**
@@ -1533,17 +1534,7 @@ public boolean equals(ByteBuffer buffer) {
15331534 * @return true if the internal array are equals (see {@link Arrays#equals(byte[], byte[])})
15341535 */
15351536 public boolean equalsContent (Bytes other ) {
1536- return other != null && equalsContent (other .internalArray ());
1537- }
1538-
1539- /**
1540- * Checks only for internal array content
1541- *
1542- * @param array to compare to
1543- * @return true if the internal array are equals (see {@link Arrays#equals(byte[], byte[])})
1544- */
1545- public boolean equalsContent (byte [] array ) {
1546- return array != null && Arrays .equals (internalArray (), array );
1537+ return other != null && Arrays .equals (internalArray (), other .internalArray ());
15471538 }
15481539
15491540 @ Override
0 commit comments