Skip to content

Commit 603af45

Browse files
committed
Implement TODO UTF8 to UTF16 conversion
1 parent b31c2e0 commit 603af45

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

libs/core/src/main/java/org/elasticsearch/core/BaseText.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import org.elasticsearch.core.bytes.BaseBytesArray;
1313
import org.elasticsearch.core.bytes.BaseBytesReference;
1414

15+
import java.nio.ByteBuffer;
1516
import java.nio.charset.StandardCharsets;
1617

1718
/**
@@ -65,7 +66,7 @@ public boolean hasString() {
6566
*/
6667
public String string() {
6768
if (text == null) {
68-
throw new UnsupportedOperationException("TODO");
69+
text = StandardCharsets.UTF_8.decode(ByteBuffer.wrap(bytes.array(), bytes.arrayOffset(), bytes.length())).toString();
6970
}
7071
return text;
7172
}

0 commit comments

Comments
 (0)