mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-08-24 04:07:09 +07:00
25 lines
618 B
Java
25 lines
618 B
Java
import java.io.BufferedReader;
|
|
import java.io.FileNotFoundException;
|
|
import java.io.FileReader;
|
|
import java.io.IOException;
|
|
|
|
class JavaClass {
|
|
|
|
private static BufferedReader br;
|
|
|
|
static String readFirstLineFromFile() throws IOException {
|
|
try (br = createReader("any")) {
|
|
return br.readLine();
|
|
}
|
|
}
|
|
|
|
private static BufferedReader createReader(String path) {
|
|
try {
|
|
return new BufferedReader(new FileReader(path));
|
|
} catch (FileNotFoundException e) {
|
|
// for example purposes #createReader shouldn't throw any checked exception
|
|
throw new RuntimeException(e);
|
|
}
|
|
}
|
|
}
|