复制.
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
class Main {
public static void main(String[] args) throws IOException {
int k = 0;
FileOutputStream fo = new FileOutputStream("D:\\newfile\\ol2.txt");
FileInputStream fi = new FileInputStream("D:\\newfile\\ol.txt");
byte[] by = new byte[1024*1024];//可以更改大小的
int b = 0;
while ((b=fi.read(by))!=-1)
fo.write(by,0,b);//读多少,写多少.
}
}
ol.txt的内容:
1234568987654322
ol2.txt的内容:
1234568987654322