public static String[] readListFromFile(File file) throws RegainException {
if (!file.exists()) {
return null;
}
FileReader reader = null;
BufferedReader buffReader = null;
try {
reader = new FileReader(file);
buffReader = new BufferedReader(reader);
ArrayList list = new ArrayList();
String line;
while ((line = buffReader.readLine()) != null) {
list.add(line);
}
String[] asArr = new String[list.size()];
list.toArray(asArr);
return asArr;
} catch (IOException exc) {
throw new RegainException("Reading word list from " + file.getAbsolutePath()
+ "failed", exc);
} finally {
if (buffReader != null) {
try {
buffReader.close();
} catch (IOException exc) {
}
}
if (reader != null) {
try {
reader.close();
} catch (IOException exc) {
}
}
}
}