List of utility methods to do InputStreamReader Read
String | readFile(File file) read File BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(file))); try { StringBuilder ret = new StringBuilder(); String line; while ((line = reader.readLine()) != null) { ret.append(line); ret.append("\n"); return ret.toString(); } finally { reader.close(); |
ArrayList | readFile(File file) read File return readFile(file, "UTF8"); |
String | readFile(File file) read File Reader in = new FileReader(file); StringWriter out = new StringWriter(); copy(in, out); return out.toString(); |
List | readFile(File file) read File List<String> lines = new ArrayList<String>(); BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(file))); String line; while ((line = reader.readLine()) != null) { lines.add(line); reader.close(); return lines; ... |
String | readFile(File file) read File StringBuilder result = new StringBuilder(); BufferedReader in = null; try { in = new BufferedReader(new InputStreamReader(new FileInputStream(file), ENCODING)); String line; while ((line = in.readLine()) != null) { result.append(line); result.append("\n"); ... |
List | readFile(File file) Reads the content of the provided file. InputStream is = new FileInputStream(file); if (file.getName().toLowerCase().endsWith(".gz")) is = new GZIPInputStream(is); List<String> lines = new ArrayList<>(); try (BufferedReader reader = new BufferedReader(new InputStreamReader(is))) { String line = reader.readLine(); while (line != null) { lines.add(line); ... |
String | readFile(File file) read File StringBuilder buffy = new StringBuilder(); BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(file), "UTF8")); String str; while ((str = in.readLine()) != null) { buffy.append(str).append("\n"); in.close(); return buffy.toString(); ... |
String | ReadFile(File file) Read File StringBuilder result = new StringBuilder(); BufferedReader reader = null; try { reader = new BufferedReader(new FileReader(file)); char[] buf = new char[1024]; int r = 0; while ((r = reader.read(buf)) != -1) { result.append(buf, 0, r); ... |
List | readFile(File file) read File List<String> lines = new ArrayList<String>(); try { FileInputStream fstream = new FileInputStream(file); DataInputStream in = new DataInputStream(fstream); BufferedReader br = new BufferedReader(new InputStreamReader(in)); String line; while ((line = br.readLine()) != null) { lines.add(line); ... |
String | readFile(File file) read File return readStream(new FileInputStream(file)); |