You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Java/Java输入输出之字节数据输入输出之综合练习.txt

24 lines
784 B

import java.io.*;
import java.util.Scanner;
public class FileTest {
public static void main(String[] args) throws IOException {
// 请在Begin-End间编写完整代码
/********** Begin **********/
// 使用字节输出流和输入流,把给定文件里的内容复制到另一个给定文件中
Scanner input = new Scanner(System.in);
String path1 = input.next();
String path2 = input.next();
FileInputStream fis = new FileInputStream(path1);
FileOutputStream fos = new FileOutputStream(path2);
int a = 0;
while((a=fis.read())!=-1){
fos.write(a);
}
fis.close();
fos.close();
/********** End **********/
}
}