mirror of
https://github.com/vee1e/flatbuffers.git
synced 2026-09-01 17:57:25 +00:00
[Java] byte buffer factory returned buffer capcity is used instead of the requested size (#5558)
* byte buffer factory returned buffer is used instead of the requested capacity * byte buffer factory returned buffer is used instead of the requested capacity * Comment fix
This commit is contained in:
parent
5797540ed0
commit
5665cfe492
1 changed files with 1 additions and 0 deletions
|
|
@ -242,6 +242,7 @@ public class FlatBufferBuilder {
|
|||
int new_buf_size = old_buf_size == 0 ? 1 : old_buf_size << 1;
|
||||
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
|
||||
nbb.position(new_buf_size - old_buf_size);
|
||||
nbb.put(bb);
|
||||
return nbb;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue