Java Utililty Methods InputStreamReader Read

List of utility methods to do InputStreamReader Read

Description

The list of methods to do InputStreamReader Read are organized into topic(s).

Method

ListreadFile(String file)
read File
return readFile(new InputStreamReader(new FileInputStream(file), "UTF-8"));
StringreadFile(String file)
read File
return readFile(file, null);
StringreadFile(String file, String charset)
read File
FileInputStream in = new FileInputStream(file);
InputStreamReader r1 = new InputStreamReader(in, charset);
BufferedReader r2 = new BufferedReader(r1);
StringBuffer sb = new StringBuffer();
while (true) {
    String s = r2.readLine();
    if (s == null)
        break;
...
StringreadFile(String file, String lineBreak)
read File
File f = new File(file);
return readFile(f, lineBreak);
ListreadFile(String fileFullPath)
read File
List<String> retList = new ArrayList<String>();
try {
    File inputFlie = new File(fileFullPath);
    InputStreamReader reader = new InputStreamReader(new FileInputStream(inputFlie));
    BufferedReader br = new BufferedReader(reader);
    String line = "";
    line = br.readLine();
    while (line != null) {
...
StringreadFile(String fileName)
Reads contents of file fully and returns as string.
FileInputStream in = null;
try {
    in = new FileInputStream(fileName);
    return read(in);
} catch (Exception e) {
    throw new RuntimeException(e);
} finally {
    close(in);
...
StringreadFile(String filename)
read File
File in = new File(filename);
try {
    Reader fr = new InputStreamReader(new FileInputStream(in), "UTF-8");
    char[] cbuf = new char[(int) in.length()];
    try {
        fr.read(cbuf);
        return String.valueOf(cbuf);
    } catch (Exception e) {
...
char[]readFile(String fileName)
read File
return readFile(fileName, null);
StringreadFile(String filename)
Reads the given filename into a string.
BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(filename)));
StringBuffer result = new StringBuffer();
String tmp = reader.readLine();
while (tmp != null) {
    result.append(tmp + "\n");
    tmp = reader.readLine();
reader.close();
...
StringreadFile(String filename)
read File
java.io.BufferedReader br = new java.io.BufferedReader(new java.io.InputStreamReader(
        Thread.currentThread().getContextClassLoader().getResourceAsStream(filename)));
StringBuffer sb = new StringBuffer();
try {
    String newline = System.getProperty("line.separator");
    String tmp = null;
    while ((tmp = br.readLine()) != null) {
        sb.append(tmp);
...