?? readfile.java
字號(hào):
/**
* A concrete class extends AbstractRead
* This class can read from a file
*/
import java.io.*;
public class ReadFile extends AbstractRead {
private BufferedReader in = null;
public ReadFile() {
}
public ReadFile(String fileName) {
resource = fileName;
}
protected boolean open() {
try {
in = new BufferedReader(new FileReader(resource));
} catch(IOException e) {
System.out.println("Can not open file!");
return false;
}
return true;
}
protected void readContent() {
try {
if(in != null) {
String str;
while((str = in.readLine()) != null) {
System.out.println(str);
}
}
} catch(IOException e) {
System.out.println("Read file error !");
}
}
protected void close() {
if(in != null) {
try {
in.close();
} catch(IOException e) {
System.out.println("IO error !");
}
}
}
}
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -