没见过的String 构造方法

ghosthuo1 2007-03-03 12:26:48
import java.io.*;
public clas FileApp
{
public static void main(String[] args)
{
byte[] buffer=new byte[2056];
try
{
FileInputStream fileIn=new FileInputStream("FileApp.java");
int bytes=fileIn.read(buffer,0,2056);
String str=new String(buffer,0,0,bytes);
        //这句是什么意思呀,,,我怎么有找到这个String 的构造方法呀,,

System.out.prionln(str);
}
catch(Exception ex)
{
System.out.println(ex);
}
}

}
...全文
203 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
lixiaoxue85 2007-03-03
  • 打赏
  • 举报
回复
String(byte[] ascii, int hibyte, int offset, int count)
已过时。 该方法无法将字节正确转换为字符。从 JDK 1.1 开始,完成该转换的首选方法是通过 String 构造方法,它接受一个字符集名称,或者使用平台默认的字符集。
ghosthuo1 2007-03-03
  • 打赏
  • 举报
回复
自己ding 一下,,

62,614

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧