Skip to content

Commit beb9398

Browse files
committed
Pass toPrimitive through primitiveAt
1 parent 9cd5206 commit beb9398

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/main/java/at/favre/lib/bytes/Bytes.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1360,7 +1360,7 @@ public byte toByte() {
13601360
*/
13611361
public char toChar() {
13621362
Util.checkExactLength(length(), 2, "char");
1363-
return internalBuffer().getChar();
1363+
return charAt(0);
13641364
}
13651365

13661366
/**
@@ -1375,7 +1375,7 @@ public char toChar() {
13751375
*/
13761376
public short toShort() {
13771377
Util.checkExactLength(length(), 2, "short");
1378-
return internalBuffer().getShort();
1378+
return shortAt(0);
13791379
}
13801380

13811381
/**
@@ -1390,7 +1390,7 @@ public short toShort() {
13901390
*/
13911391
public int toInt() {
13921392
Util.checkExactLength(length(), 4, "int");
1393-
return internalBuffer().getInt();
1393+
return intAt(0);
13941394
}
13951395

13961396
/**
@@ -1405,7 +1405,7 @@ public int toInt() {
14051405
*/
14061406
public long toLong() {
14071407
Util.checkExactLength(length(), 8, "long");
1408-
return resize(8).internalBuffer().getLong();
1408+
return longAt(0);
14091409
}
14101410

14111411
/**
@@ -1431,7 +1431,7 @@ public float toFloat() {
14311431
*/
14321432
public double toDouble() {
14331433
Util.checkExactLength(length(), 8, "double");
1434-
return resize(8).internalBuffer().getDouble();
1434+
return internalBuffer().getDouble();
14351435
}
14361436

14371437
/**

0 commit comments

Comments
 (0)