From f29925a78e3fd74fb12b21401d244e9982173633 Mon Sep 17 00:00:00 2001 From: AustrianToast Date: Sun, 5 Mar 2023 00:08:13 +0100 Subject: [PATCH] Completed importCSV method Added BufferedReader with FileReader surrounded by a try/catch --- src/Matrix.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/Matrix.java b/src/Matrix.java index c47e882..5f23912 100644 --- a/src/Matrix.java +++ b/src/Matrix.java @@ -1,4 +1,7 @@ import java.io.BufferedReader; +import java.io.FileNotFoundException; +import java.io.FileReader; +import java.io.IOException; public class Matrix { public static void main(String[] args) { @@ -7,7 +10,22 @@ public class Matrix { public String[] importCSV() { String[] result = null; + String line; + try { + BufferedReader br = new BufferedReader(new FileReader("")); + + line = br.readLine(); + while (line != null) { + result = line.trim().split(";"); + } + + br.close(); + } catch (FileNotFoundException e) { + e.getStackTrace(); + } catch (IOException e) { + e.getStackTrace(); + } return result; } } \ No newline at end of file