mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-28 20:40:01 +00:00
If the user passes in a {{CharBuffer}} himser, reward him by
eliminating the last remaining allocation in string creation
This commit is contained in:
@@ -382,7 +382,8 @@ public class FlatBufferBuilder {
|
|||||||
|
|
||||||
dst.clear();
|
dst.clear();
|
||||||
|
|
||||||
CharBuffer src = CharBuffer.wrap(s);
|
CharBuffer src = s instanceof CharBuffer ? (CharBuffer) s :
|
||||||
|
CharBuffer.wrap(s);
|
||||||
CoderResult result = encoder.encode(src, dst, true);
|
CoderResult result = encoder.encode(src, dst, true);
|
||||||
if (result.isError()) {
|
if (result.isError()) {
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user