Skip to content

Commit 3d1bec4

Browse files
committed
Use cached stringEnd on subsequent calls to getValueAsByteRef()
1 parent ae432e1 commit 3d1bec4

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

libs/x-content/impl/src/main/java/org/elasticsearch/xcontent/provider/json/ESUTF8StreamJsonParser.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ public ESUTF8StreamJsonParser(
4646
*/
4747
public ESBytesRef getValueAsByteRef() throws IOException {
4848
if (_currToken == JsonToken.VALUE_STRING && _tokenIncomplete) {
49+
if(stringEnd > 0) {
50+
return new ESBytesRef(_inputBuffer, _inputPtr, stringEnd-1);
51+
}
4952
return _finishAndReturnByteRef();
5053
}
5154
return null;

0 commit comments

Comments
 (0)