Skip to content

Instantly share code, notes, and snippets.

@BMU-Verlag
Created July 9, 2020 08:14
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
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