简单I/O

OutputStream,InputStream,FileOutputStream,FileInputStream.

fis = new FileInputStream("C:/Desktop/from.txt");
fos = new FileOutputStream("C:/Desktop/to.txt");

int read(byte[],int offset,int length).返回值为字节流的长度

int temp=read(byte[],int offset,int length);

void write(byte[],int offset,temp);

第一步:导入类,import java.io.*

第二步:声明输入流/输出流引用

FileInputStream fis=null;
FileOutputStream fos=null;

第三步:生成代表输入流或输出流的对象

fis = new FileInputStream("C:/Desktop/from.txt");
fos = new FileOutputStream("C:/Desktop/to.txt");

第四步:生成一个字节数组

byte [] buffer=new byte[100];

原文地址:https://www.cnblogs.com/gracyandjohn/p/3967264.html