📄 通过read方法依次地从fileinputstram中读取字节信息.txt
字号:
import java.io.*;
public class FileStreamDemo{
public static void main(String args[]){
try{
int b;
FileInputStream fis = new FileInputStream("Input.dat");
FileOutputStream fos = new FileOutputStream("Output.dat");
while( (b=fis.read() ) != -1) //判断是否结束
fos.write((int)b);
fis.close();
fos.close();
}catch(FileNotFoundException e){
e.printStackTrace();//异常处理
}catch(IOException e){
e.printStackTrace(); //异常处理
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -