use of java.util.Scanner in project languagetool by languagetool-org.
the class PortugueseAccentuationDataLoader method loadWords.
Map<String, AnalyzedTokenReadings> loadWords(String path) {
final Map<String, AnalyzedTokenReadings> map = new HashMap<>();
final InputStream inputStream = JLanguageTool.getDataBroker().getFromRulesDirAsStream(path);
try (Scanner scanner = new Scanner(inputStream, FILE_ENCODING)) {
while (scanner.hasNextLine()) {
final String line = scanner.nextLine().trim();
if (line.isEmpty() || line.charAt(0) == '#') {
// ignore comments
continue;
}
final String[] parts = line.split(";");
if (parts.length != 3) {
throw new RuntimeException("Format error in file " + path + ", line: " + line + ", " + "expected 3 semicolon-separated parts, got " + parts.length);
}
final AnalyzedToken analyzedToken = new AnalyzedToken(parts[1], parts[2], null);
map.put(parts[0], new AnalyzedTokenReadings(analyzedToken, 0));
}
}
return map;
}
use of java.util.Scanner in project realm-java by realm.
the class ComputerIdentifierGenerator method getWindowsIdentifier.
private static String getWindowsIdentifier() throws IOException, NoSuchAlgorithmException {
Runtime runtime = Runtime.getRuntime();
Process process = runtime.exec(new String[] { "wmic", "csproduct", "get", "UUID" });
String result = null;
InputStream is = process.getInputStream();
Scanner sc = new Scanner(process.getInputStream());
try {
while (sc.hasNext()) {
String next = sc.next();
if (next.contains("UUID")) {
result = sc.next().trim();
break;
}
}
} finally {
is.close();
}
return result == null ? UNKNOWN : Utils.hexStringify(Utils.sha256Hash(result.getBytes()));
}
use of java.util.Scanner in project zoj by licheng.
the class Main method main.
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
PrintWriter out = new PrintWriter(System.out);
try {
for (; ; ) {
int a = in.nextInt();
int b = in.nextInt();
out.println(a + b);
}
} catch (NoSuchElementException e) {
}
out.close();
}
use of java.util.Scanner in project zoj by licheng.
the class Main method main.
public static void main() {
Scanner in = new Scanner(System.in);
PrintWriter out = new PrintWriter(System.out);
try {
for (; ; ) {
int a = in.nextInt();
int b = in.nextInt();
out.println(a + b);
}
} catch (NoSuchElementException e) {
}
out.close();
}
use of java.util.Scanner in project HanLP by hankcs.
the class PlayGround method main.
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
String line;
while ((line = scanner.nextLine()).length() > 0) {
seg(line);
}
}
Aggregations