📄 copyfile.java
字号:
import java.io.*;
/**
* Makes a copy of a file.
*
* @author author name
* @version 1.0
*/
public class CopyFile {
/* Standard input stream */
private static BufferedReader stdIn =
new BufferedReader(new InputStreamReader(System.in));
/* Standard output stream */
private static PrintWriter stdOut =
new PrintWriter(System.out, true);
/* Standard error stream */
private static PrintWriter stdErr =
new PrintWriter(System.err, true);
/**
* Makes a copy of a file.
*
* @param args not used.
* @throws IOException If an I/O error occurs.
*/
public static void main(String[] args) throws IOException {
stdErr.print("Source filename: ");
stdErr.flush();
BufferedReader input =
new BufferedReader( new FileReader(stdIn.readLine()));
stdErr.print("Destination filename: ");
stdErr.flush();
PrintWriter output =
new PrintWriter(new FileWriter(stdIn.readLine()));
String line = input.readLine();
while (line != null) {
output.println(line);
line = input.readLine();
}
input.close();
output.close();
stdOut.println("done");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -