Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class FileService {
- private static Path currentRelativePath = Paths.get("src");
- private static File fileDirectory = new File(currentRelativePath + "/main/resources/");
- public static List<String> parseFile(String fileName){
- List<String> texts = new ArrayList<>();
- try (BufferedReader br = new BufferedReader(new FileReader(fileDirectory + fileName))) {
- while (true) {
- String line= br.readLine();
- if(line==null)break;
- texts.add(line);
- }
- } catch (IOException e) {
- e.printStackTrace();
- }
- return texts;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement