use of java.io.FileReader in project CoreNLP by stanfordnlp.
the class TregexGUI method loadTsurgeonScript.
private void loadTsurgeonScript() {
if (chooser == null)
chooser = createFileChooser();
int status = chooser.showOpenDialog(this);
if (status == JFileChooser.APPROVE_OPTION) {
Thread t = new Thread() {
@Override
public void run() {
try {
BufferedReader reader = new BufferedReader(new FileReader(chooser.getSelectedFile().toString()));
final String tregexPatternString = Tsurgeon.getTregexPatternFromReader(reader);
final String tsurgeonOperationsString = Tsurgeon.getTsurgeonTextFromReader(reader);
SwingUtilities.invokeLater(() -> InputPanel.getInstance().setScriptAndPattern(tregexPatternString, tsurgeonOperationsString));
} catch (IOException e) {
System.out.println("Error parsing Tsurgeon file");
//e.printStackTrace();
}
}
};
t.start();
}
}
use of java.io.FileReader in project Cloud9 by lintool.
the class AFormatterWG method readStopList.
private static HashSet<Integer> readStopList(JobConf jc) {
HashSet<Integer> out = new HashSet<Integer>();
try {
//System.out.println(">> " + DistributedCache.getLocalCacheFiles(jc).toString());
Path[] cacheFiles = DistributedCache.getLocalCacheFiles(jc);
//String[] cacheFiles;
//cacheFiles = jc.getStrings("stoplist");
FileReader fr = new FileReader(cacheFiles[0].toString());
BufferedReader stopReader = new BufferedReader(fr);
String line;
while ((line = stopReader.readLine()) != null) {
out.add(Integer.parseInt(line));
}
stopReader.close();
return out;
} catch (IOException ioe) {
System.err.println("IOException reading from distributed cache");
System.err.println(ioe.toString());
return out;
}
}
use of java.io.FileReader in project Cloud9 by lintool.
the class HFormatterWG method readStopList.
private static HashSet<Integer> readStopList(JobConf jc) {
HashSet<Integer> out = new HashSet<Integer>();
try {
//System.out.println(">> " + DistributedCache.getLocalCacheFiles(jc).toString());
Path[] cacheFiles = DistributedCache.getLocalCacheFiles(jc);
//String[] cacheFiles;
//cacheFiles = jc.getStrings("stoplist");
FileReader fr = new FileReader(cacheFiles[0].toString());
BufferedReader stopReader = new BufferedReader(fr);
String line;
while ((line = stopReader.readLine()) != null) {
out.add(Integer.parseInt(line));
}
stopReader.close();
return out;
} catch (IOException ioe) {
System.err.println("IOException reading from distributed cache");
System.err.println(ioe.toString());
return out;
}
}
use of java.io.FileReader in project camel by apache.
the class FileHelper method loadFile.
/**
* Loads the file
*/
public static List<String> loadFile(File file) throws Exception {
List<String> lines = new ArrayList<>();
LineNumberReader reader = new LineNumberReader(new FileReader(file));
String line;
do {
line = reader.readLine();
if (line != null) {
lines.add(line);
}
} while (line != null);
reader.close();
return lines;
}
use of java.io.FileReader in project databus by linkedin.
the class CheckpointSerializerMain method loadProperties.
private static Properties loadProperties(String fileName) throws IOException {
Properties result = new Properties();
FileReader freader = new FileReader(fileName);
try {
result.load(freader);
} finally {
freader.close();
}
return result;
}
Aggregations