FileInputStream fileInputStream = new FileInputStream("test_dir/test_file.txt");
byte[] buffer = new byte[1024];
fileInputStream.read(buffer);
for (byte b : buffer) {
System.out.println(b);
}
fileInputStream.close(); FileInputStream fileInputStream = new FileInputStream("test_dir/test_file.txt");
int x;
while((x=fileInputStream.read())!= -1)
System.out.println(x);
fileInputStream.close();上面2段代码输出的数字为何不同?(忽略byte数组多余的零)
添加回答
举报
0/150
提交
取消