1public class FileReader {
2
3 public void readLines(BufferedReader reader) throws IOException {
4 String line;
5 while ((line = reader.readLine()) != null) {
6 System.out.println(line);
7 }
8 }
9
10 public static void main(String[] args) {
11 try (BufferedReader reader = Files.newBufferedReader(Path.of("data.csv"))) {
12 new FileReader().readLines(reader);
13 } catch (IOException ioe) {
14 throw new IllegalStateException("Can not read file", ioe);
15 }
16 }
17}