public static void CopyFile(String x1,String x2) throws IOException {
//x1是原始路径,x2是要复制到的路径
try (InputStream input=new FileInputStream(x1);
OutputStream output=new FileOutputStream(x2)){
int n=0;
while ((n=input.read())!=-1){
output.write(n);
}
其他条件可以再加
Sign in to make a reply
我很有素质
public static void CopyFile(String x1,String x2) throws IOException {
//x1是原始路径,x2是要复制到的路径
try (InputStream input=new FileInputStream(x1);
OutputStream output=new FileOutputStream(x2)){
int n=0;
while ((n=input.read())!=-1){
output.write(n);
}
}
}
其他条件可以再加