FileInputStream fis = null;
FileOutputStream fos = null;
try {
fis = new FileInputStream("");
fos = new FileOutputStream("");
int readData = 0;
byte[] bytes = new byte[1024*1024];
while((readData = fis.read(bytes))!=-1){
fos.write(bytes,0,readData);
}
fos.flush();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}finally{
if(fis!=null){
try {
fis.close();
} catch (IOException e) {
e.printStackTrace();
}
if(fos!=null){
try {
fos.close();
} catch (IOException e) {
e.printStackTrace();
}
}
文件拷贝(FileInputStream&FileOutPutStream)
于 2022-10-12 14:16:39 首次发布