use of java.io.LineNumberReader in project webanno by webanno.
the class WebannoTsv3XReader method getNext.
@Override
public void getNext(JCas aJCas) throws IOException, CollectionException {
Resource res = nextFile();
initCas(aJCas, res);
try (LineNumberReader br = new LineNumberReader(new InputStreamReader(res.getInputStream(), encoding))) {
new Tsv3XDeserializer().read(br, aJCas);
}
}
use of java.io.LineNumberReader in project zotero-libreoffice-integration by zotero.
the class RegistrationHandler method findServicesImplementationClasses.
/**
* @return all the UNO implementation classes.
*/
@SuppressWarnings("unchecked")
private static Class[] findServicesImplementationClasses() {
ArrayList<Class> classes = new ArrayList<Class>();
InputStream in = RegistrationHandler.class.getResourceAsStream("RegistrationHandler.classes");
LineNumberReader reader = new LineNumberReader(new InputStreamReader(in));
try {
String line = reader.readLine();
while (line != null) {
if (!line.equals("")) {
line = line.trim();
try {
Class clazz = Class.forName(line);
Class[] writeTypes = new Class[] { XRegistryKey.class };
Class[] getTypes = new Class[] { String.class };
Method writeRegMethod = clazz.getMethod("__writeRegistryServiceInfo", writeTypes);
Method getFactoryMethod = clazz.getMethod("__getComponentFactory", getTypes);
if (writeRegMethod != null && getFactoryMethod != null) {
classes.add(clazz);
}
} catch (Exception e) {
e.printStackTrace();
}
}
line = reader.readLine();
}
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
reader.close();
in.close();
} catch (Exception e) {
}
;
}
return classes.toArray(new Class[classes.size()]);
}
use of java.io.LineNumberReader in project tesb-rt-se by Talend.
the class RunTrace method isNextRow.
public boolean isNextRow() {
if (!openSocket) {
return false;
}
InputStream in;
try {
askForStatus();
in = s.getInputStream();
LineNumberReader reader = new LineNumberReader(new InputStreamReader(in));
// $NON-NLS-1$
return "NEXT_ROW".equals(reader.readLine());
} catch (IOException e) {
e.printStackTrace();
return false;
}
}
use of java.io.LineNumberReader in project tesb-rt-se by Talend.
the class RunTrace method waitForUserAction.
public void waitForUserAction() throws InterruptedException {
if (!openSocket) {
return;
}
InputStream in;
try {
boolean action = false;
// $NON-NLS-1$
pred.println("UI_STATUS");
do {
in = s.getInputStream();
LineNumberReader reader = new LineNumberReader(new InputStreamReader(in));
String line = reader.readLine();
if ("STATUS_WAITING".equals(line)) {
pred.println("UI_STATUS");
Thread.sleep(100);
} else {
action = true;
}
} while (!action);
} catch (IOException e) {
e.printStackTrace();
}
}
use of java.io.LineNumberReader in project tesb-rt-se by Talend.
the class RunTrace method isPause.
public boolean isPause() {
if (!openSocket) {
return false;
}
InputStream in;
try {
askForStatus();
in = s.getInputStream();
LineNumberReader reader = new LineNumberReader(new InputStreamReader(in));
// $NON-NLS-1$
return "PAUSE".equals(reader.readLine());
} catch (IOException e) {
e.printStackTrace();
return false;
}
}
Aggregations