List of utility methods to do InputStreamReader Read
String | readFile(File f) read File try { return readFile(new FileInputStream(f)); } catch (FileNotFoundException e) { e.printStackTrace(); return null; |
String | readFile(File f) read File StringBuilder result = new StringBuilder(); Reader in = null; try { in = new InputStreamReader(new FileInputStream(f), "utf-8"); int c = 0; while ((c = in.read()) >= 0) { result.append((char) c); } finally { if (in != null) { in.close(); return result.toString(); |
String | readFile(File file) read File Reader in = new FileReader(file); StringWriter out = new StringWriter(); copy(in, out); return out.toString(); |
String | readFile(File file) read File return readFile(file, null);
|
LinkedList | readFile(File file) read File LinkedList<String> ret = new LinkedList<String>(); FileInputStream fis = null; InputStreamReader isr = null; BufferedReader br = null; try { fis = new FileInputStream(file); isr = new InputStreamReader(fis); br = new BufferedReader(isr); ... |
String | readFile(File file) read File return readFile(file, UTF8);
|
String | readFile(File file) Read an entire file into a string. Reader reader = new FileReader(file); return readFile(reader); |
StringBuffer | readFile(File file) read File FileInputStream fin = new FileInputStream(file); StringBuffer result = new StringBuffer(); String thisLine = ""; BufferedReader myInput = new BufferedReader(new InputStreamReader(fin)); while ((thisLine = myInput.readLine()) != null) { result.append(thisLine); result.append("\n"); myInput.close(); fin.close(); return result; |
String | readFile(File file) read File Reader in = new InputStreamReader(new FileInputStream(file), "UTF-8"); StringBuilder buff = new StringBuilder(); int c; while ((c = in.read()) != -1) { buff.append((char) c); in.close(); return buff.toString(); ... |
String | readFile(File file) read File BufferedReader br = null; DataInputStream in = null; StringBuffer sBuffer = new StringBuffer(); try { in = new DataInputStream(new FileInputStream(file)); br = new BufferedReader(new InputStreamReader(in)); String sCurrentLine = null; while ((sCurrentLine = br.readLine()) != null) { ... |