Java BufferedReader Read loadLineByLineAndTrim(String file_path)

Here you can find the source of loadLineByLineAndTrim(String file_path)

Description

load Line By Line And Trim

License

Apache License

Declaration

public static List<String> loadLineByLineAndTrim(String file_path) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.io.BufferedReader;

import java.io.File;

import java.io.FileReader;

import java.util.ArrayList;

import java.util.List;

public class Main {
    public static List<String> loadLineByLineAndTrim(String file_path) {
        List<String> lines = new ArrayList<String>();
        try {/*ww w . ja  v  a  2  s  .  c  o  m*/
            File f = new File(file_path);
            if (!f.exists())
                return lines;
            BufferedReader br1 = new BufferedReader(new FileReader(f));
            while (br1.ready()) {
                String line = br1.readLine();
                lines.add(line.trim());
            }
            br1.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return lines;
    }
}

Related

  1. loadJCC()
  2. loadJson(String path)
  3. loadKey(String filename)
  4. loadLastExpInfo(String lastExpFileName)
  5. loadLine(InputStream load)
  6. loadLines(InputStream in, List lines)
  7. loadLines(String file)
  8. loadLines(String fileName)
  9. loadList(File f, String enc)