各位带我解读一下这段代码吧 看着有点懵
public class demo02 {
public static void main(String[] args) throws Exception{
FileInputStream fis= new FileInputStream("d:\\00.txt");
byte[] buf = new byte[8];
int count = fis.read(buf);//我想问问fis.read()括号里面填的是什么东西 对象吗
System.out.println(new String(buf));
System.out.print(count);
fis.close();
}
}
int count = fis.read(buf);
System.out.println(new String(buf)); //我想问问fis.read()括号里面填的是什么东西 对象吗
byte[] buf = new byte[8]生成缓存用于存放读入的字节
int count = fis.read(buf);返回读入缓冲区的字节总数,到末尾返回-1
byte[] buf = new byte[8]; ,是一个字节数组。
fis.read(buf),会把缓冲区的数据读取到buf字节数组中,然后你可以通过这个字节数组进一步处理。
数组啊,上面不是定义的byte8位的数组么,有什么疑问