摘要:    
  1.Java的默认编码
内容:
1.Java的默认编码 
java的src.zip包中的java.nio.charset.Charset类中defaultCharset()方法说明java的编码类型是有jvm的file.encoding参数决定的,如果未指定默认是UTF-8
/**
* Returns the default charset of this Java virtual machine.
*
* <p> The default charset is determined during virtual-machine startup and
* typically depends upon the locale and charset of the underlying
* operating system.
*
* @return A charset object for the default charset
*
* @since 1.5
*/
public static Charset defaultCharset() {
if (defaultCharset == null) {
synchronized (Charset.class) {
String csn = AccessController.doPrivileged(
new GetPropertyAction("file.encoding"));
Charset cs = lookup(csn);
if (cs != null)
defaultCharset = cs;
else
defaultCharset = forName("UTF-8");
}
}
return defaultCharset;
}

相关文章:

  • 2021-08-13
  • 2021-11-27
  • 2021-12-19
  • 2021-12-02
  • 2022-02-19
  • 2022-12-23
  • 2022-01-07
  • 2021-11-20
猜你喜欢
  • 2021-11-20
  • 2022-12-23
  • 2021-11-20
  • 2021-06-06
  • 2021-04-09
  • 2021-05-22
  • 2021-11-28
相关资源
相似解决方案