Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2019
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. public class FileService {
  2. private static Path currentRelativePath = Paths.get("src");
  3. private static File fileDirectory = new File(currentRelativePath + "/main/resources/");
  4.  
  5. public static List<String> parseFile(String fileName){
  6. List<String> texts = new ArrayList<>();
  7. try (BufferedReader br = new BufferedReader(new FileReader(fileDirectory + fileName))) {
  8. while (true) {
  9. String line= br.readLine();
  10. if(line==null)break;
  11. texts.add(line);
  12. }
  13. } catch (IOException e) {
  14. e.printStackTrace();
  15. }
  16.  
  17. return texts;
  18. }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement