Advertisement
Guest User

Untitled

a guest
Nov 1st, 2014
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. public static String readTextFile(String fileName) {
  2.  
  3. String returnValue = "";
  4. FileReader file = null;
  5.  
  6. try {
  7.  
  8. file = new FileReader(fileName);
  9. BufferedReader reader = new BufferedReader(file);
  10. String line = "";
  11. while ((line = reader.readLine()) != null) {
  12. //////System.out.println(line);
  13.  
  14. //line = line.replace("~", "");
  15. //if (!line.endsWith("~")) line = line + "~";
  16. //if (line == "" || line.startsWith("~") || line.length() <= 1){
  17. // line = ChatColor.GREEN + " ~";
  18. //}
  19. returnValue += line;
  20. //////System.out.println(line);
  21.  
  22. }
  23. } catch (Exception e) {
  24. e.printStackTrace();
  25. throw new RuntimeException(e);
  26. } finally {
  27. if (file != null) {
  28. try {
  29. file.close();
  30. } catch (IOException e) {
  31. // Ignore issues during closing
  32. }
  33. }
  34. }
  35. return returnValue;
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement