Advertisement
Guest User

Untitled

a guest
May 25th, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. public static void main(String[] args)
  2. {
  3. try {
  4. File fileDir = new File("c:\\temp\\test.txt");
  5.  
  6. BufferedReader in = new BufferedReader(
  7. new InputStreamReader(
  8. new FileInputStream(fileDir), "UTF8"));
  9.  
  10. String str;
  11.  
  12. while ((str = in.readLine()) != null) {
  13. System.out.println(str);
  14. }
  15.  
  16. in.close();
  17. }
  18. catch (UnsupportedEncodingException e)
  19. {
  20. System.out.println(e.getMessage());
  21. }
  22. catch (IOException e)
  23. {
  24. System.out.println(e.getMessage());
  25. }
  26. catch (Exception e)
  27. {
  28. System.out.println(e.getMessage());
  29. }
  30. }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement