Läuft.
This commit is contained in:
parent
e18773d1e7
commit
2ccc2cbb0b
6
.idea/vcs.xml
generated
Normal file
6
.idea/vcs.xml
generated
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>
|
||||
8
pom.xml
8
pom.xml
@ -71,6 +71,14 @@
|
||||
<mainClass>net.altimate.app.App</mainClass>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<source>21</source>
|
||||
<target>21</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
|
||||
|
||||
|
||||
@ -2,6 +2,7 @@ package net.altimate.app;
|
||||
import java.lang.Object;
|
||||
import java.lang.Class;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Arrays;
|
||||
|
||||
import javafx.application.Application;
|
||||
import javafx.collections.FXCollections;
|
||||
@ -20,6 +21,8 @@ import javafx.scene.layout.GridPane;
|
||||
import javafx.scene.layout.VBox;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
import static java.util.stream.Collectors.toList;
|
||||
|
||||
|
||||
public class App extends Application {
|
||||
|
||||
@ -268,17 +271,54 @@ public class App extends Application {
|
||||
@Override
|
||||
public void handle(ActionEvent e) {
|
||||
|
||||
ListFilesInDir.listFilesInDir(filesDirectory);
|
||||
|
||||
//System.out.println(Arrays.stream(ListFilesInDir.listFilesInDir(filesDirectory)).toList());
|
||||
int filesDirTmpLength = ListFilesInDir.listFilesInDir(filesDirectory).length;
|
||||
String filesDirTmp[] = new String[filesDirTmpLength];
|
||||
filesDirTmp = ListFilesInDir.listFilesInDir(filesDirectory);
|
||||
String filesDir[][] = new String[filesDirTmpLength][filesDirTmpLength];
|
||||
|
||||
|
||||
for ( int i=0; i < filesDirTmpLength; ++i) {
|
||||
filesDir[i][0] = filesDirTmp[i];
|
||||
String readTheFile = filesDirectory + "/" + filesDirTmp[i];
|
||||
filesDir[i][1] = ReadFile.readFile(filesDirectory + "/" + filesDirTmp[i]);
|
||||
//filesDir[0][i] = ReadFile.readFile(filesDirTmp[i]);
|
||||
//ReadFile.readFile(filesDirTmp[i]);
|
||||
|
||||
|
||||
System.out.println("da: " + filesDir[i][0]);
|
||||
System.out.println("da tmp: " + filesDir[i][1]);
|
||||
System.out.println(i);
|
||||
//System.out.println("inhalt file: " + filesDir[i][i]);
|
||||
|
||||
}
|
||||
//System.out.println(ReadFile.readFile("/tmp/files/123.smart"));
|
||||
//ReadFile.readFile("/tmp/files/123.smart");
|
||||
|
||||
//System.out.println("dada: " + filesDirTmp[0]);
|
||||
|
||||
//filesDirTmp = Arrays.copyOf(ListFilesInDir.listFilesInDir(filesDirectory), ListFilesInDir.listFilesInDir(filesDirectory).length);
|
||||
//new String[ListFilesInDir.listFilesInDir(filesDirectory).length][ListFilesInDir.listFilesInDir(filesDirectory).length];
|
||||
|
||||
|
||||
//filesDir[][] = ListFilesInDir.listFilesInDir(filesDirectory);
|
||||
//System.out.println(filesDir.length);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
ListView<String> list1 = new ListView<String>();
|
||||
ObservableList<String> items = FXCollections.observableArrayList (ListFilesInDir.listFilesInDir(filesDirectory));
|
||||
list1.setItems(items);
|
||||
GridPane.setConstraints(list1, 0, 1);
|
||||
grid.getChildren().add(list1);
|
||||
|
||||
String fileName = "/tmp/files/1735938766.smart";
|
||||
//String fileName = "/tmp/files/1735938766.smart";
|
||||
//ReadFile.readFile(fileName);
|
||||
|
||||
System.out.println(ReadFile.readFile(fileName));
|
||||
//System.out.println(ReadFile.readFile(fileName));
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
@ -1,29 +1,57 @@
|
||||
package net.altimate.app;
|
||||
import java.io.File;
|
||||
|
||||
import static java.util.regex.Pattern.matches;
|
||||
|
||||
|
||||
public class ListFilesInDir {
|
||||
public static String[] listFilesInDir ( String directory ) {
|
||||
public static String[] listFilesInDir(String directory) {
|
||||
|
||||
File filesInDir = null;
|
||||
File[] paths;
|
||||
String match = "^.*.smart$";
|
||||
|
||||
int count=0;
|
||||
int filterArrayLength=0;
|
||||
|
||||
try {
|
||||
filesInDir = new File(directory);
|
||||
//paths = filesInDir.listFiles();
|
||||
|
||||
|
||||
//for(File path:paths) {
|
||||
// System.out.println(path.getName().matches(".smart"));
|
||||
// System.out.println("ok");
|
||||
//
|
||||
|
||||
|
||||
} catch(Exception efile){
|
||||
|
||||
efile.printStackTrace();
|
||||
}
|
||||
|
||||
paths = filesInDir.listFiles();
|
||||
|
||||
for (File path:paths) {
|
||||
if (path.getName().matches(match)) {
|
||||
filterArrayLength++;
|
||||
}
|
||||
}
|
||||
|
||||
for(File path:paths) {
|
||||
System.out.println(path.getName());
|
||||
String[] filter = new String[filterArrayLength];
|
||||
|
||||
for (File path:paths) {
|
||||
if (path.getName().matches(match)) {
|
||||
filter[count] = path.getName();
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//return filesInDir.list();
|
||||
System.out.println("ListFilesInDir wurde aufgerufen");
|
||||
return filter;
|
||||
|
||||
|
||||
} catch(Exception efile) {
|
||||
|
||||
efile.printStackTrace();
|
||||
}
|
||||
return filesInDir.list();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -10,11 +10,13 @@ public class ReadFile {
|
||||
try {
|
||||
String s = Files.readString(Path.of(fileName));
|
||||
String s1 = s;
|
||||
System.out.println(s1);
|
||||
//System.out.println("Es wurde versucht ein file zu lesen");
|
||||
//System.out.println(s1);
|
||||
return s1;
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
System.out.println("ein fehler im einlesen?");
|
||||
String o = null;
|
||||
return o;
|
||||
}
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,8 @@
|
||||
net/altimate/app/ReadFile.class
|
||||
net/altimate/app/App$2.class
|
||||
net/altimate/app/App$3.class
|
||||
net/altimate/app/App.class
|
||||
net/altimate/app/ListFilesInDir.class
|
||||
net/altimate/app/App$4.class
|
||||
net/altimate/app/App$1.class
|
||||
net/altimate/app/CreateFile.class
|
||||
@ -1 +1,4 @@
|
||||
/home/mic/DM/workspaces/tmp/superclass-app/src/main/java/net/altimate/app/App.java
|
||||
/home/mic/DM/workspaces/tmp/superclass-app/src/main/java/net/altimate/app/CreateFile.java
|
||||
/home/mic/DM/workspaces/tmp/superclass-app/src/main/java/net/altimate/app/ListFilesInDir.java
|
||||
/home/mic/DM/workspaces/tmp/superclass-app/src/main/java/net/altimate/app/ReadFile.java
|
||||
|
||||
Loading…
Reference in New Issue
Block a user