?? copyfile.java
字號(hào):
// FileInputStrem和FileOutputStream的綜合應(yīng)用。
import java.io.*;
class CopyFile {
public static void main(String args[])
throws IOException
{
int i;
FileInputStream opfin;
FileOutputStream opfout;
try {
opfin = new FileInputStream("test11_1.txt"); // 打開(kāi)輸入文件
} catch(FileNotFoundException exc)
{
System.out.println("Input File Not Found");
return;
}
try {
opfout = new FileOutputStream("test11_2.txt"); // 打開(kāi)輸出文件
} catch(FileNotFoundException exc) {
System.out.println("Error Opening Output File");
return;
}
try { // 復(fù)制文件
do {
i = opfin.read();
if(i != -1) opfout.write(i);
} while(i != -1);
} catch(IOException exc)
{
System.out.println("File Error");
}
opfin.close();
opfout.close();
}
}
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -