Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2019
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. public static void Skaityti(String failas) throws IOException {
  2.  
  3. BufferedReader br = new BufferedReader(new FileReader(failas));
  4. try {
  5. StringBuilder sb = new StringBuilder();
  6. String line = br.readLine();
  7.  
  8. while (line != null) {
  9. sb.append(line);
  10. sb.append(System.lineSeparator());
  11. System.out.println(line);
  12. line = br.readLine();
  13. }
  14. String everything = sb.toString();
  15. } catch (FileNotFoundException ex) {
  16. System.out.println("Failas nerastas");
  17. } finally {
  18. br.close();
  19. }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement