Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
public static String dateiEinlesen(String dateiname){
try{
FileInputStream fis = new FileInputStream(dateiname);
InputStreamReader isr = new InputStreamReader(fis);
BufferedReader br = new BufferedReader(isr);
String linie = br.readLine();
String inhalt = "";
while (linie != null){
inhalt += linie;
linie = br.readLine();
}
br.close();
return inhalt;
}
catch (IOException ioAusnahme){
System.out.println("Datei konnte nicht geöffnet werden.");
return "Fehler";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment