import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
public class FileInputStreamTest {
public static void main(String[] args) throws IOException {
//文件
File file=new File("E:\\java.txt");
//流
FileInputStream fis =new FileInputStream(file);
//篮子
byte[] bytes=new byte[1024];
//计数
int temp;
//循环读
while ((temp=fis.read(bytes))!=-1) {
System.out.println(new String(bytes,0,temp));
}
}
}
![](https://i-blog.csdnimg.cn/blog_migrate/48c1087dee775247fc8b7bab92be8fa4.png)