List of utility methods to do BufferedReader Read All
String | readAll(InputStream stream) read All BufferedReader reader = null; try { reader = new BufferedReader(new InputStreamReader(stream)); StringBuilder b = new StringBuilder(); String line = null; while ((line = reader.readLine()) != null) { b.append(line); return b.toString(); } finally { if (reader != null) reader.close(); |
String | readAll(Reader reader) read All StringBuilder buf = new StringBuilder(); int in; while ((in = reader.read()) != -1) { char ch = (char) in; buf.append(ch); return buf.toString(); |
String | readAll(Reader reader) read All BufferedReader bufferedReader = new BufferedReader(reader); StringBuilder builder = new StringBuilder(); String line; while ((line = bufferedReader.readLine()) != null) { builder.append(line).append("\n"); bufferedReader.close(); return builder.toString(); ... |
String | readAll(Reader reader) read All StringBuffer buffer = new StringBuffer(); BufferedReader in = new BufferedReader(reader); int ch; while ((ch = in.read()) > -1) { buffer.append((char) ch); in.close(); return buffer.toString(); ... |
String | readAll(Reader reader) Suck all the data from a Reader into a String . StringBuilder result = new StringBuilder(); BufferedReader buffered = new BufferedReader(reader); char[] chunk = new char[4096]; int howMany; try { while (-1 != (howMany = buffered.read(chunk))) { result.append(chunk, 0, howMany); } finally { reader.close(); return result.toString(); |
Set | readAll(String fileName) read All BufferedReader reader = new BufferedReader(new FileReader(fileName)); Set<String> s = new HashSet<String>(); String line; while ((line = reader.readLine()) != null) { if (!"".equals(line)) { s.add(line); return s; |
String | readAll(String fileName) read All StringBuilder sb = new StringBuilder(); Reader fr = new InputStreamReader(ClassLoader.class.getResourceAsStream(fileName), "UTF-8"); BufferedReader br = new BufferedReader(fr); String s; while ((s = br.readLine()) != null) { sb.append(s); fr.close(); ... |
String | readAll(String filePath) read All try { FileReader fr = new FileReader(filePath); BufferedReader br = new BufferedReader(fr); String res = ""; String buf; while ((buf = br.readLine()) != null) { res += buf; br.close(); fr.close(); return res; } catch (IOException e) { e.printStackTrace(); return null; |
String | readAll(String filePathAndName) read text file content, return string split by "\n" return readAll(filePathAndName, DEFAULT_ENCODING);
|
List | readAll(String ip) read All if (ip == null) { return null; BufferedReader br = null; List<String> result = new ArrayList<String>(); File file = null; synchronized (monitor) { try { ... |