< 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,11 +24,10 @@
*/
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;
@@ -309,11 +308,12 @@
throw new IllegalCharsetNameException(s);
}
}
/* The standard set of charsets */
- private static final CharsetProvider standardProvider = new StandardCharsets();
+ 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,11 +607,11 @@
.privilegedGetProperty("file.encoding");
Charset cs = lookup(csn);
if (cs != null)
defaultCharset = cs;
else
- defaultCharset = sun.nio.cs.UTF_8.INSTANCE;
+ defaultCharset = StandardCharsets.UTF_8;
}
}
return defaultCharset;
}
< prev index next >