List of utility methods to do FileReader Create
List | loadFile(File file) load File List<String> lines = new ArrayList<String>(); if (file.exists()) { BufferedReader reader = new BufferedReader(new FileReader(file)); String line = reader.readLine(); while (line != null) { line = line.trim(); if (line.length() != 0) { lines.add(line); ... |
String | readTextFile(String fullPathFilename) read Text File StringBuffer contents = new StringBuffer(); BufferedReader reader = null; reader = new BufferedReader(new FileReader(fullPathFilename)); String text = null; while ((text = reader.readLine()) != null) { contents.append(text).append( System.getProperty("line.separator")); reader.close(); return contents.toString(); |