List of utility methods to do FileReader Create
String | readTextFile(File file) read Text File StringBuilder fileData = new StringBuilder(1000); BufferedReader reader = new BufferedReader(new FileReader(file)); char[] buf = new char[1024]; int numRead = 0; while ((numRead = reader.read(buf)) != -1) { String readData = String.valueOf(buf, 0, numRead); fileData.append(readData); buf = new char[1024]; ... |
StringBuffer | readTextFile(File file, boolean newline) read Text File if (!file.exists()) { throw new FileNotFoundException(); StringBuffer buf = new StringBuffer(); BufferedReader in = null; try { in = new BufferedReader(new FileReader(file)); String str; ... |
String[][] | readTextFile(File file, int header) Generic function to read a text file into a double[][] with an arbitrary number of columns. String[][] output = null; BufferedReader reader = null; try { reader = new BufferedReader(new FileReader(file)); for (int i = 1; i <= header; i++) { reader.readLine(); String line = reader.readLine(); ... |
String | readTextfile(final String filename) Reads a text file into a string. return readTextfile(new File(filename)); |
String[] | readTextFile(InputStream in) Reads the text from the given input stream in the default encoding. return readTextFile(in, null);
|
String[] | readTextFile(InputStream in) Reads the text from the given input stream in the default encoding. return readTextFile(in, null);
|
StringBuffer | readTextFile(String completePath) Read a textfile into a StringBuffer. StringBuffer buf = new StringBuffer(); File file = new File(completePath); try { FileReader fr = new FileReader(file); char buffer[] = new char[1024]; int read = 1; while (read > 0) { read = fr.read(buffer); ... |
String | readTextFile(String file) read Text File StringBuffer buffer = new StringBuffer(1024); BufferedReader reader = new BufferedReader(new FileReader(file)); char[] chars = new char[1024]; while ((reader.read(chars)) > -1) { buffer.append(String.valueOf(chars)); reader.close(); return buffer.toString(); ... |
String | readTextFile(String file) Read the file into a String. File rFile = new File(file); StringBuffer sb = new StringBuffer(1024); BufferedReader reader = new BufferedReader(new FileReader(rFile.getPath())); char[] chars = new char[1]; try { while ((reader.read(chars)) > -1) { sb.append(String.valueOf(chars)); chars = new char[1]; ... |
String | readTextFile(String file) read Text File String everything; try (BufferedReader br = new BufferedReader(new FileReader(file))) { StringBuilder sb = new StringBuilder(); String line = br.readLine(); while (line != null) { sb.append(line); sb.append(System.lineSeparator()); line = br.readLine(); ... |