文件的一个复制
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
public class ShareIo {
public static void main(String[] args) {
FileInputStream fie = null;
FileOutputStream fio = null;
try {
fie = new FileInputStream("d:/test.txt");
fio = new FileOutputStream("d:\\FFFF.txt");
//读取
byte[] br=new byte[1024];
int len=0;
while((len=fie.read(br))!=-1){
fio.write(br, 0, len);
System.out.println("OK了");
}
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
fio.close();
fie.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}