📄 collectionwrapper.java
字号:
// 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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -