List of utility methods to do FileReader Read
String | readFile(String filename) Returns the content of the file with the specified name as a string. return readFile(new File(filename)); |
String | readFile(String fileName) read File StringBuffer result = new StringBuffer(); char b[] = new char[2048]; FileReader fis = new FileReader(fileName); int n; while ((n = fis.read(b)) > 0) { result.append(b, 0, n); fis.close(); ... |
String | readFile(String filename) Read a file's contents into a string. File file = new File(filename); StringBuffer buf = new StringBuffer((int) file.length() + 2); FileReader in = new FileReader(file); int c; while ((c = in.read()) != -1) { buf.append((char) c); in.close(); ... |
String | readFile(String filename) read File String res = ""; FileReader in = new FileReader(filename); char[] buffer = new char[1024]; int n = 1; while (n > 0) { n = in.read(buffer, 0, buffer.length); if (n > 0) { res += new String(buffer, 0, n); ... |
String | readFile(String fileName) read File StringBuffer sb = new StringBuffer(); Vector v = readFileByLine(fileName); boolean isDataInVector = (v.size() > 0); if (isDataInVector) { for (int i = 0; i < v.size(); i++) { sb.append(v.elementAt(i)); sb.append("\n"); return sb.toString(); } else { return null; |
void | readFile(String fileName, StringBuffer buffer) Reads a file into a StringBuffer .
FileReader fr = new FileReader(fileName); buffer.setLength(0); int c; while ((c = fr.read()) != -1) { buffer.append((char) c); fr.close(); |
String[] | readFileAsArray(String filename) Reads a file into a string array LinkedList<String> file = new LinkedList<String>(); String[] lines = new String[0]; String line; FileReader reader = null; LineNumberReader lineReader = null; try { reader = new FileReader(filename); lineReader = new LineNumberReader(reader); ... |
String | readFileOrThrow(File file) Reads the contents of a File. Reader reader = null; try { reader = new FileReader(file); char[] buf = new char[8192]; int len; StringBuilder s = new StringBuilder(); while ((len = reader.read(buf)) >= 0) { s.append(buf, 0, len); ... |