forked from BigfootDev/flatbuffers
[Java] Avoid casting ByteBuffer to Buffer (#6785)
* Revert "avoiding even more NoSuchMethod exceptions (#6729)" This reverts commit6fb2c90d9e. * Revert "avoiding more NoSuchMethod exceptions (#6671)" This reverts commit752c7b576d. * Revert "avoiding NoSuchMethod exception (#6658)" This reverts commit813d3632ec. * Use Java 8 for Kotlin Linux builds to verify
This commit is contained in:
@@ -2,7 +2,6 @@ package com.google.flatbuffers;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
import java.nio.Buffer;
|
||||
|
||||
public class ByteBufferReadWriteBuf implements ReadWriteBuf {
|
||||
|
||||
@@ -15,7 +14,7 @@ public class ByteBufferReadWriteBuf implements ReadWriteBuf {
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
((Buffer) buffer).clear();
|
||||
buffer.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -118,9 +117,9 @@ public class ByteBufferReadWriteBuf implements ReadWriteBuf {
|
||||
public void set(int index, byte[] value, int start, int length) {
|
||||
requestCapacity(index + (length - start));
|
||||
int curPos = buffer.position();
|
||||
((Buffer) buffer).position(index);
|
||||
buffer.position(index);
|
||||
buffer.put(value, start, length);
|
||||
((Buffer) buffer).position(curPos);
|
||||
buffer.position(curPos);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user