Advertisement
kadyz

Untitled

Feb 23rd, 2020
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. import java.io.IOException;
  2. import java.io.FileReader;
  3. import java.io.BufferedReader;
  4.  
  5. public class ReadJournal {
  6.  
  7. private String path;
  8.  
  9. public ReadJournal(String file_path) {
  10. path = file_path;
  11. }
  12.  
  13. int readLines() throws IOException {
  14. FileReader fr = new FileReader(path);
  15. BufferedReader bf = new BufferedReader(fr);
  16.  
  17. String line;
  18. int lineNr = 0;
  19.  
  20. while ((line = bf.readLine()) != null) {
  21. lineNr++;
  22. }
  23. bf.close();
  24.  
  25. return lineNr;
  26. }
  27.  
  28.  
  29. public String[] OpenFile() throws IOException {
  30.  
  31. FileReader fr = new FileReader (path);
  32. BufferedReader tr = new BufferedReader(fr);
  33.  
  34. int lineNr = readLines();
  35. String[] textData = new String[lineNr];
  36.  
  37. int i;
  38.  
  39. for (i=0; i < lineNr; i++) {
  40.  
  41. }
  42. tr.close();
  43. return textData;
  44.  
  45. }
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement