while((num = fis.read(b))!=-1)
{
System.out.print(new String(b,10,num));
System.out.print(new String("--------");
}
{
System.out.print(new String(b,10,num));
System.out.print(new String("--------");
}
调试欢乐多
通过使用平台的默认字符集解码指定的 byte 子数组,构造一个新的 String。
参数: bytes:要解码为字符的 byte
offset: 要解码的第一个 byte 的索引
length: 要解码的 byte 数 的长度
这 offset 取值必需是:
0 <= offset <= bytes.length - length所以你上面 offset 取值为 0 <= offset <= 1024 - num
你只需检查num的值为多少就知道offset该取什么值了;