Skip to content

Instantly share code, notes, and snippets.

@BMU-Verlag
Created July 9, 2020 08:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BMU-Verlag/ab571c367596c9f80533171ac91789fa to your computer and use it in GitHub Desktop.
Save BMU-Verlag/ab571c367596c9f80533171ac91789fa to your computer and use it in GitHub Desktop.
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