FileInputStream fis = new FileInputStream("D:\\aa.txt");
BufferedOutputStream bos = new BufferedOutputStream(
new FileOutputStream("D:\\aa.txt"));
byte[] b = new byte[1024];
int len = fis.read(b); --1
while (len != -1) {
bos.write(b); --2
len = fis.read(b); --3
}
bos.flush(); --4
bos.close();
fis.close();