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:
@@ -18,7 +18,6 @@ package com.google.flatbuffers;
|
||||
|
||||
import static com.google.flatbuffers.Constants.*;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.Buffer;
|
||||
import java.nio.ByteOrder;
|
||||
|
||||
/// @cond FLATBUFFERS_INTERNAL
|
||||
@@ -151,7 +150,7 @@ public class Table {
|
||||
protected ByteBuffer __vector_as_bytebuffer(int vector_offset, int elem_size) {
|
||||
int o = __offset(vector_offset);
|
||||
if (o == 0) return null;
|
||||
ByteBuffer bb = ((ByteBuffer) (((Buffer) this.bb).duplicate())).order(ByteOrder.LITTLE_ENDIAN);
|
||||
ByteBuffer bb = this.bb.duplicate().order(ByteOrder.LITTLE_ENDIAN);
|
||||
int vectorstart = __vector(o);
|
||||
bb.position(vectorstart);
|
||||
bb.limit(vectorstart + __vector_len(o) * elem_size);
|
||||
@@ -175,7 +174,7 @@ public class Table {
|
||||
int vectorstart = __vector(o);
|
||||
bb.rewind();
|
||||
bb.limit(vectorstart + __vector_len(o) * elem_size);
|
||||
((Buffer) bb).position(vectorstart);
|
||||
bb.position(vectorstart);
|
||||
return bb;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user