Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8261418: Reduce decoder creation overheads for sun.nio.cs.ext Charsets #2480

Closed
wants to merge 4 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -85,7 +85,7 @@ static class Decoder extends CharsetDecoder {
private boolean shiftOut;
private byte currentSODesig;

private static final DoubleByte.Decoder gb2312Decoder =
private static final DoubleByte.Decoder GB2312 =
(DoubleByte.Decoder)new EUC_CN().newDecoder();

Decoder(Charset cs) {
@@ -119,8 +119,8 @@ private char SODecode(byte byte1, byte byte2, byte SOD) {
byte1 |= MSB;
byte2 |= MSB;
if (SOD == SODesigGB) {
return gb2312Decoder.decodeDouble(byte1 & 0xff,
byte2 & 0xff);
return GB2312.decodeDouble(byte1 & 0xff,
byte2 & 0xff);
} else { // SOD == SODesigCNS
return EUC_TW.Decoder.decodeSingleOrReplace(byte1 & 0xff,
byte2 & 0xff,
@@ -110,8 +110,7 @@ private boolean findDesig(byte[] in, int sp, int sl) {
if (sl - sp >= SOD.length) {
int j = 0;
while (j < SOD.length && in[sp + j] == SOD[j]) { j++; }
if (j == SOD.length)
return true;
return j == SOD.length;
}
return false;
}