当前页面: 开发资料首页 → J2SE 专题 → platform's default charset是什么东西?
platform's default charset是什么东西?
摘要: platform's default charset是什么东西?
String(byte[] bytes)
Constructs a new String by decoding the specified array of bytes using the platform-#39;s default charset.
关于构造一个字节数组的String对象,文档里面的这个解说看得不是很明白,有没有哪位兄弟举例介绍介绍?
意思是,用平台即操作系统默认的编码方式来读取char[]字符数组,并转化成字符串类型的。
意思是
char c=new char[10];
String s=new String(c);
如果在简体中文的操作系统上,上面两行等效于
char c=new char[10];
String s=new String(c,-#34;GB2312-#34;);
可分明是byte[] bytes,是字节数组啊?
不好意思,写错了,上面的char应该是byte才对,昨晚睡不好,今天迷糊了:)