refactor(JSONWriterUTF8): Optimize string encoding methods
Refactored the string encoding logic by removing redundant variable assignments and modifying method visibility for better performance and maintainability.
This commit is contained in:
parent
0a5013ead7
commit
c12ef42a7e
@ -471,7 +471,7 @@ class JSONWriterUTF8
|
||||
this.bytes[this.off++] = (byte) quote;
|
||||
}
|
||||
|
||||
public void writeStringLatin1(byte[] value) {
|
||||
public final void writeStringLatin1(byte[] value) {
|
||||
if ((context.features & MASK_BROWSER_SECURE) != 0) {
|
||||
writeStringLatin1BrowserSecure(value);
|
||||
return;
|
||||
|
@ -15,10 +15,8 @@ final class JSONWriterUTF8JDK9
|
||||
return;
|
||||
}
|
||||
|
||||
int coder = STRING_CODER.applyAsInt(str);
|
||||
byte[] value = STRING_VALUE.apply(str);
|
||||
|
||||
if (coder == 0) {
|
||||
if (STRING_CODER.applyAsInt(str) == 0) {
|
||||
writeStringLatin1(value);
|
||||
} else {
|
||||
writeStringUTF16(value);
|
||||
|
Loading…
x
Reference in New Issue
Block a user