< prev index next >
src/java.base/share/classes/java/nio/charset/Charset.java
Print this page
8200310: Avoid charset lookup machinery in java.nio.charset.StandardCharsets
Reviewed-by: sherman
*** 24,34 ****
*/
package java.nio.charset;
import jdk.internal.misc.VM;
- import sun.nio.cs.StandardCharsets;
import sun.nio.cs.ThreadLocalCoders;
import sun.security.action.GetPropertyAction;
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
--- 24,33 ----
*** 309,319 ****
throw new IllegalCharsetNameException(s);
}
}
/* The standard set of charsets */
! private static final CharsetProvider standardProvider = new StandardCharsets();
private static final String[] zeroAliases = new String[0];
// Cache of the most-recently-returned charsets,
// along with the names that were used to find them
--- 308,319 ----
throw new IllegalCharsetNameException(s);
}
}
/* The standard set of charsets */
! private static final CharsetProvider standardProvider
! = new sun.nio.cs.StandardCharsets();
private static final String[] zeroAliases = new String[0];
// Cache of the most-recently-returned charsets,
// along with the names that were used to find them
*** 607,617 ****
.privilegedGetProperty("file.encoding");
Charset cs = lookup(csn);
if (cs != null)
defaultCharset = cs;
else
! defaultCharset = sun.nio.cs.UTF_8.INSTANCE;
}
}
return defaultCharset;
}
--- 607,617 ----
.privilegedGetProperty("file.encoding");
Charset cs = lookup(csn);
if (cs != null)
defaultCharset = cs;
else
! defaultCharset = StandardCharsets.UTF_8;
}
}
return defaultCharset;
}
< prev index next >