mirror of
https://github.com/vee1e/flatbuffers.git
synced 2026-09-01 17:57:25 +00:00
parent
7c3e267e1e
commit
752c7b576d
7 changed files with 12 additions and 12 deletions
|
|
@ -15,7 +15,7 @@ public class ByteBufferReadWriteBuf implements ReadWriteBuf {
|
|||
|
||||
@Override
|
||||
public void clear() {
|
||||
buffer.clear();
|
||||
((Buffer) buffer).clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ public class FlatBufferBuilder {
|
|||
this.bb_factory = bb_factory;
|
||||
if (existing_bb != null) {
|
||||
bb = existing_bb;
|
||||
bb.clear();
|
||||
((Buffer) bb).clear();
|
||||
bb.order(ByteOrder.LITTLE_ENDIAN);
|
||||
} else {
|
||||
bb = bb_factory.newByteBuffer(initial_size);
|
||||
|
|
@ -154,7 +154,7 @@ public class FlatBufferBuilder {
|
|||
public FlatBufferBuilder init(ByteBuffer existing_bb, ByteBufferFactory bb_factory){
|
||||
this.bb_factory = bb_factory;
|
||||
bb = existing_bb;
|
||||
bb.clear();
|
||||
((Buffer) bb).clear();
|
||||
bb.order(ByteOrder.LITTLE_ENDIAN);
|
||||
minalign = 1;
|
||||
space = bb.capacity();
|
||||
|
|
@ -235,7 +235,7 @@ public class FlatBufferBuilder {
|
|||
*/
|
||||
public void clear(){
|
||||
space = bb.capacity();
|
||||
bb.clear();
|
||||
((Buffer) bb).clear();
|
||||
minalign = 1;
|
||||
while(vtable_in_use > 0) vtable[--vtable_in_use] = 0;
|
||||
vtable_in_use = 0;
|
||||
|
|
@ -275,7 +275,7 @@ public class FlatBufferBuilder {
|
|||
|
||||
((Buffer) bb).position(0);
|
||||
ByteBuffer nbb = bb_factory.newByteBuffer(new_buf_size);
|
||||
new_buf_size = nbb.clear().capacity(); // Ensure the returned buffer is treated as empty
|
||||
new_buf_size = ((Buffer) nbb).clear().capacity(); // Ensure the returned buffer is treated as empty
|
||||
((Buffer) nbb).position(new_buf_size - old_buf_size);
|
||||
nbb.put(bb);
|
||||
return nbb;
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ public class Utf8Old extends Utf8 {
|
|||
if (cache.lastOutput == null || cache.lastOutput.capacity() < estimated) {
|
||||
cache.lastOutput = ByteBuffer.allocate(Math.max(128, estimated));
|
||||
}
|
||||
cache.lastOutput.clear();
|
||||
((Buffer) cache.lastOutput).clear();
|
||||
cache.lastInput = in;
|
||||
CharBuffer wrap = (in instanceof CharBuffer) ?
|
||||
(CharBuffer) in : CharBuffer.wrap(in);
|
||||
|
|
@ -68,7 +68,7 @@ public class Utf8Old extends Utf8 {
|
|||
throw new IllegalArgumentException("bad character encoding", e);
|
||||
}
|
||||
}
|
||||
cache.lastOutput.flip();
|
||||
((Buffer) cache.lastOutput).flip();
|
||||
return cache.lastOutput.remaining();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue