public class aaa {
public static void main(String[] args) throws IOException {
//把 a.txt 中的数据拷贝到 b.txt 中
BufferedInputStream bis=new BufferedInputStream(new FileInputStream("a.txt"));
BufferedOutputStream bos=new BufferedOutputStream(new FileOutputStream("b.txt"));
byte[] b=new byte[1024];//用 byte 数组一次拷贝多个字节
int len;
while ((len=bis.read(b))!=-1){
bos.write(b,0,len);
}
bos.close();
bis.close();
}
}
初学者,见解不足,如有错误请指出