Merge branch 'master' of https://github.com/google/flatbuffers
This commit is contained in:
commit
208c15f29d
|
@ -368,7 +368,8 @@ public class FlatBufferBuilder {
|
||||||
/// @endcond
|
/// @endcond
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Encode the string `s` in the buffer using UTF-8.
|
* Encode the string `s` in the buffer using UTF-8. If {@code s} is
|
||||||
|
* already a {@link CharBuffer}, this method is allocation free.
|
||||||
*
|
*
|
||||||
* @param s The string to encode.
|
* @param s The string to encode.
|
||||||
* @return The offset in the buffer where the encoded string starts.
|
* @return The offset in the buffer where the encoded string starts.
|
||||||
|
@ -382,7 +383,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 {
|
||||||
|
|
Loading…
Reference in New Issue