-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
19d5541
commit 55883e0
Showing
3 changed files
with
64 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,4 +42,4 @@ bin/ | |
|
||
/API | ||
/logs | ||
/src/main/java/test | ||
/src/main/java/test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package pl.nightdev701.io; | ||
|
||
import pl.nightdev701.logger.AbstractLogger; | ||
|
||
import java.io.BufferedReader; | ||
import java.io.FileNotFoundException; | ||
import java.io.FileReader; | ||
import java.io.IOException; | ||
import java.util.logging.Level; | ||
|
||
public class ScorpionFileReader { | ||
|
||
private BufferedReader bufferedReader; | ||
private String currentLine; | ||
private AbstractLogger logger; | ||
|
||
public ScorpionFileReader(String filePath, AbstractLogger logger) { | ||
|
||
this.logger = logger; | ||
|
||
try { | ||
FileReader fileReader = new FileReader(filePath); | ||
bufferedReader = new BufferedReader(fileReader); | ||
currentLine = bufferedReader.readLine(); // Lese die erste Zeile | ||
} catch (FileNotFoundException e) { | ||
logger.log(Level.WARNING,"Die Datei wurde nicht gefunden: " + e.getMessage()); | ||
} catch (IOException e) { | ||
logger.log(Level.WARNING,"Fehler beim Lesen der Datei: " + e.getMessage()); | ||
} | ||
} | ||
|
||
public String getCurrentLine() { | ||
return currentLine; | ||
} | ||
|
||
public void readNextLine() { | ||
try { | ||
currentLine = bufferedReader.readLine(); // Gehe zur nächsten Zeile | ||
} catch (IOException e) { | ||
logger.log(Level.WARNING,"Fehler beim Lesen der nächsten Zeile: " + e.getMessage()); | ||
} | ||
} | ||
|
||
public void close() { | ||
try { | ||
if (bufferedReader != null) { | ||
bufferedReader.close(); | ||
} | ||
} catch (IOException e) { | ||
logger.log(Level.WARNING,"Fehler beim Schließen des Readers: " + e.getMessage()); | ||
} | ||
} | ||
|
||
} |