Test?
This commit is contained in:
commit
88d1b3a1af
3
.idea/.gitignore
vendored
Normal file
3
.idea/.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
1
.idea/.name
Normal file
1
.idea/.name
Normal file
@ -0,0 +1 @@
|
||||
Execute.java
|
6
.idea/misc.xml
Normal file
6
.idea/misc.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="17" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
8
.idea/modules.xml
Normal file
8
.idea/modules.xml
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/VPR_SCRIPT.iml" filepath="$PROJECT_DIR$/VPR_SCRIPT.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
6
.idea/vcs.xml
Normal file
6
.idea/vcs.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
11
VPR_SCRIPT.iml
Normal file
11
VPR_SCRIPT.iml
Normal file
@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
BIN
out/production/VPR_SCRIPT/Execute.class
Normal file
BIN
out/production/VPR_SCRIPT/Execute.class
Normal file
Binary file not shown.
BIN
out/production/VPR_SCRIPT/GeneralMethods.class
Normal file
BIN
out/production/VPR_SCRIPT/GeneralMethods.class
Normal file
Binary file not shown.
13
src/Execute.java
Normal file
13
src/Execute.java
Normal file
@ -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<String> data = GeneralMethods.readData("test.csv");
|
||||
for(String d : data){
|
||||
System.out.println(d);
|
||||
}
|
||||
GeneralMethods.writeData("test2.csv",data);
|
||||
}
|
||||
}
|
53
src/GeneralMethods.java
Normal file
53
src/GeneralMethods.java
Normal file
@ -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<String> readData(String pathRead){
|
||||
try {
|
||||
ArrayList<String> data = new ArrayList<String>();
|
||||
List<String> lines = Files.readAllLines(Paths.get(pathRead));
|
||||
for(String line : lines){
|
||||
data.add(line);
|
||||
}
|
||||
return data;
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
return new ArrayList<String>();
|
||||
}
|
||||
}
|
||||
|
||||
/**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<String> 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();
|
||||
}
|
||||
}
|
||||
}
|
7
test.csv
Normal file
7
test.csv
Normal file
@ -0,0 +1,7 @@
|
||||
erstdfzg
|
||||
rsedtfgzhu
|
||||
ersdtfgzhuji
|
||||
trdfzghui
|
||||
rtdfzu
|
||||
t
|
||||
dztdrs5456
|
|
Loading…
Reference in New Issue
Block a user