List of utility methods to do BufferedReader Read
HashMap | readFileToHashMap(String filePath, String separator, boolean valueFirst) Method to read a properties file into a HashMap . if (separator == null) { separator = "="; List<String> lines = readFileToLinesList(filePath); HashMap<String, String> propertiesMap = new HashMap<String, String>(); for (String line : lines) { line = line.trim(); if (line.length() == 0) { ... |
void | readFileToList(String fileName, List read File To List readFileToList(new File(fileName), list);
|
List | readFileToList(String path, String split) Reads contents of files and splits it into an array by List object List<String> tmp = new ArrayList<String>(); String[] array = readFile(path).split(split); for (int i = 0; i < array.length; i++) { tmp.add(array[i]); return tmp; |
List | readFileToListOfStrings(File file) read File To List Of Strings List<String> strings = new LinkedList<>(); BufferedReader reader = null; try { reader = new BufferedReader(new FileReader(file)); String line; while ((line = reader.readLine()) != null) { line = line.replaceAll("\r", "").replaceAll("\n", "").replaceAll(" ", ""); strings.add(line); ... |
String | readFileValue(File file) read File Value BufferedReader reader = null; String line = null; try { FileReader fr = new FileReader(file); reader = new BufferedReader(fr); line = reader.readLine(); } finally { if (reader != null) { ... |
String | readFileWithoutLineBreak(String filename, boolean skipEmptyLine) read File Without Line Break StringBuilder sb = new StringBuilder(); BufferedReader br = new BufferedReader(new FileReader(filename)); try { String line; while ((line = br.readLine()) != null) { if (skipEmptyLine && line.trim().length() == 0) { continue; sb.append(line); } finally { br.close(); return sb.toString(); |