public void bincopy(File file,File dir) throws IOException{
BufferedInputStream bis = new BufferedInputStream(new FileInputStream(file));
BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(new File(dir,file.getName())));
int len =0;
while((len=bis.read()) !=-1){
bos.write(len);
}
bos.close();
bis.close();
}
public static void main(String[] args) throws IOException {
File f1 = new File("C:\\Users\\lx\\Desktop\\src.zip");
File f2 = new File("C:\\Users\\lx\\Desktop\\1");
new Demo8().bincopy(f1, f2);
}
拷贝二进制文件BufferedinputStream- BufferedoutputStream
最新推荐文章于 2023-10-11 23:27:27 发布