Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/classes/modules/java.base/java/lang/String.java
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,19 @@ public byte[] getBytes(Charset x){
return StringCoding.encode(x, coder(), value);
}

/**
* If two coders are different and target is big enough,
* invoker guarantees that the target is in UTF16
*/
void getBytes(byte dst[], int dstBegin, byte coder) {
assert coder == UTF16;
if (coder() == coder) {
System.arraycopy(value, 0, dst, dstBegin << coder, value.length);
} else { // this.coder == LATIN1 && coder == UTF16
StringLatin1.inflate(value, 0, dst, dstBegin, value.length);
}
}

native public byte[] getBytes();
@Override
native public boolean equals(Object anObject);
Expand Down