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

StringreadFile(File f)
read File
try {
    return readFile(new FileInputStream(f));
} catch (FileNotFoundException e) {
    e.printStackTrace();
return null;
StringreadFile(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();
StringreadFile(File file)
read File
Reader in = new FileReader(file);
StringWriter out = new StringWriter();
copy(in, out);
return out.toString();
StringreadFile(File file)
read File
return readFile(file, null);
LinkedListreadFile(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);
...
StringreadFile(File file)
read File
return readFile(file, UTF8);
StringreadFile(File file)

Read an entire file into a string.

Reader reader = new FileReader(file);
return readFile(reader);
StringBufferreadFile(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;
StringreadFile(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();
...
StringreadFile(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) {
...