commit 88d1b3a1af958b50c346599537a5b715889b8ee1 Author: Sabine Gubitz Date: Thu Nov 24 13:59:26 2022 +0100 Test? diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/.idea/.name b/.idea/.name new file mode 100644 index 0000000..0b19974 --- /dev/null +++ b/.idea/.name @@ -0,0 +1 @@ +Execute.java \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..07115cd --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..2c0f267 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/VPR_SCRIPT.iml b/VPR_SCRIPT.iml new file mode 100644 index 0000000..c90834f --- /dev/null +++ b/VPR_SCRIPT.iml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/out/production/VPR_SCRIPT/Execute.class b/out/production/VPR_SCRIPT/Execute.class new file mode 100644 index 0000000..11f93cb Binary files /dev/null and b/out/production/VPR_SCRIPT/Execute.class differ diff --git a/out/production/VPR_SCRIPT/GeneralMethods.class b/out/production/VPR_SCRIPT/GeneralMethods.class new file mode 100644 index 0000000..fc5fdc4 Binary files /dev/null and b/out/production/VPR_SCRIPT/GeneralMethods.class differ diff --git a/src/Execute.java b/src/Execute.java new file mode 100644 index 0000000..2e37190 --- /dev/null +++ b/src/Execute.java @@ -0,0 +1,13 @@ +import java.util.ArrayList; + +/**The class Execute is the executen file for the whole programm. + */ +public class Execute { + public static void main (String[]args){ + ArrayList data = GeneralMethods.readData("test.csv"); + for(String d : data){ + System.out.println(d); + } + GeneralMethods.writeData("test2.csv",data); + } +} diff --git a/src/GeneralMethods.java b/src/GeneralMethods.java new file mode 100644 index 0000000..872442d --- /dev/null +++ b/src/GeneralMethods.java @@ -0,0 +1,53 @@ +import java.io.BufferedWriter; +import java.io.FileWriter; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.List; + +/**GeneralMethods is a class for commen public methods. + * + * @auhtor Felix Wöstemeyer + * + * @version 1.0 + */ +public class GeneralMethods { + + /**The method readData gives back an ArrayList from the data of a given file. + * + * @param pathRead the given filepath to read + * @return returns an ArrayList of Strings with the read data + */ + public static ArrayList readData(String pathRead){ + try { + ArrayList data = new ArrayList(); + List lines = Files.readAllLines(Paths.get(pathRead)); + for(String line : lines){ + data.add(line); + } + return data; + } catch (IOException e) { + e.printStackTrace(); + return new ArrayList(); + } + } + + /**The method writeData saves the given data to a certain file. + * + * @param pathWrite the given filepath to write + * @param data the data to be saved + */ + public static void writeData(String pathWrite, ArrayList data){ + try{ + BufferedWriter writer = new BufferedWriter(new FileWriter(pathWrite)); + for (String d : data) { + writer.write(d); + writer.newLine(); + } + writer.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } +} diff --git a/test.csv b/test.csv new file mode 100644 index 0000000..43bcbe6 --- /dev/null +++ b/test.csv @@ -0,0 +1,7 @@ +erstdfzg +rsedtfgzhu +ersdtfgzhuji +trdfzghui +rtdfzu +t +dztdrs5456 \ No newline at end of file diff --git a/test2.csv b/test2.csv new file mode 100644 index 0000000..16a6e97 --- /dev/null +++ b/test2.csv @@ -0,0 +1,7 @@ +erstdfzg +rsedtfgzhu +ersdtfgzhuji +trdfzghui +rtdfzu +t +dztdrs5456