public static void main(String[] args) {
Test03 test = new Test03();
String s1 ="C:\\Users\\REALE ME\\Desktop\\hello1.mp4";
String s2="C:\\Users\\REALE ME\\Desktop\\hello2.mp4";
test.testt(s1,s2);
}
public void testt(String s1,String s2){
FileInputStream fi = null;
FileOutputStream fo = null;
try {
File f1 = new File(s1);
File f2 = new File(s2);
fi = new FileInputStream(f1);
fo = new FileOutputStream(f2);
int len;
byte[] bytes = new byte[1024];
while((len = fi.read(bytes))!=-1){
fo.write(bytes);
}
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
fi.close();
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
fo.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
FileInputStream
最新推荐文章于 2024-07-09 16:46:46 发布