collectionwrapper.java
来自「一个美国教授写得很好的java学生管理系统」· Java 代码 · 共 45 行
JAVA
45 行
// CollectionWrapper.java - Chapter 16 version.
// Copyright 2000 by Jacquie Barker - all rights reserved.
// An IMPLEMENTATION class.
package DataInterface;
import java.io.*;
public abstract class CollectionWrapper {
private String pathToFile;
public boolean initializeObjects(String pathToFile, boolean primary) {
this.pathToFile = pathToFile;
String line = null;
BufferedReader bIn = null;
boolean outcome = true;
try {
// Open the file.
bIn = new BufferedReader(new FileReader(pathToFile));
line = bIn.readLine();
while (line != null) {
if (primary) parseData(line);
else parseData2(line);
line = bIn.readLine();
}
bIn.close();
}
catch (FileNotFoundException f) {
outcome = false;
}
catch (IOException i) {
outcome = false;
}
return outcome;
}
public abstract void parseData(String line);
public abstract void parseData2(String line);
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?