List of utility methods to do InputStreamReader Create
Reader | getReader(final File file) Method getReader final FileInputStream fileinputstream = new FileInputStream(file); final byte bytes[] = readUpTo(fileinputstream, 100); fileinputstream.close(); final String s = normalizeEncoding(getEncoding(bytes)); return new InputStreamReader(new FileInputStream(file), s); |
Reader | getReader(final InputStream is) get Reader final Reader result = new InputStreamReader(is); return result; |
Reader | getReader(String name, String extension) get Reader File f = new File(name); if (f.exists()) return new FileReader(f); f = new File(name + extension); if (f.exists()) return new FileReader(f); f = new File(name + ".gz"); if (!f.exists()) ... |
InputStreamReader | getReaderForFile(IFile file) get Reader For File InputStream contents = file.getContents(); InputStreamReader r = new InputStreamReader(contents, file.getCharset()); return r; |
String | readTextFile(File f) read Text File StringBuffer buf = new StringBuffer(); BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(f), "UTF-8")); String inputLine; while ((inputLine = in.readLine()) != null) { buf.append(inputLine); buf.append('\n'); in.close(); ... |
String | readTextFile(File f) read Text File StringBuffer buf = new StringBuffer(); BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(f), "UTF-8")); String inputLine; while ((inputLine = in.readLine()) != null) { buf.append(inputLine); buf.append('\n'); in.close(); ... |
String | readTextFile(File f) read Text File StringBuffer buf = new StringBuffer(); BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(f))); String inputLine; while ((inputLine = in.readLine()) != null) { buf.append(inputLine); buf.append('\n'); in.close(); ... |
String | readTextFile(File f) read Text File StringBuffer buf = new StringBuffer(); BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(f))); String inputLine; while ((inputLine = in.readLine()) != null) { buf.append(inputLine); buf.append('\n'); in.close(); ... |
String | readTextFile(File f) read Text File Reader br = new BufferedReader(new InputStreamReader(new FileInputStream(f), "UTF-8")); return readText(br); |
String | readTextFile(File f, int maxNumLines) Read in the last few lines of a (newline delimited) textfile, or null if the file doesn't exist. if (!f.exists()) return null; FileInputStream fis = null; BufferedReader in = null; try { fis = new FileInputStream(f); in = new BufferedReader(new InputStreamReader(fis)); List<String> lines = new ArrayList<String>(maxNumLines); ... |