forked from BigfootDev/flatbuffers
avoiding NoSuchMethod exception (#6658)
This commit is contained in:
@@ -31,6 +31,7 @@
|
||||
package com.google.flatbuffers;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.Buffer;
|
||||
import static java.lang.Character.MAX_SURROGATE;
|
||||
import static java.lang.Character.MIN_SUPPLEMENTARY_CODE_POINT;
|
||||
import static java.lang.Character.MIN_SURROGATE;
|
||||
@@ -310,7 +311,7 @@ final public class Utf8Safe extends Utf8 {
|
||||
}
|
||||
if (inIx == inLength) {
|
||||
// Successfully encoded the entire string.
|
||||
out.position(outIx + inIx);
|
||||
((Buffer) out).position(outIx + inIx);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -353,7 +354,7 @@ final public class Utf8Safe extends Utf8 {
|
||||
}
|
||||
|
||||
// Successfully encoded the entire string.
|
||||
out.position(outIx);
|
||||
((Buffer) out).position(outIx);
|
||||
} catch (IndexOutOfBoundsException e) {
|
||||
// TODO(nathanmittler): Consider making the API throw IndexOutOfBoundsException instead.
|
||||
|
||||
@@ -434,7 +435,7 @@ final public class Utf8Safe extends Utf8 {
|
||||
int start = out.arrayOffset();
|
||||
int end = encodeUtf8Array(in, out.array(), start + out.position(),
|
||||
out.remaining());
|
||||
out.position(end - start);
|
||||
((Buffer) out).position(end - start);
|
||||
} else {
|
||||
encodeUtf8Buffer(in, out);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user