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 file)
read File
if (file == null) {
    return null;
StringBuilder sbData = new StringBuilder();
BufferedReader bufferedReader = null;
try {
    bufferedReader = new BufferedReader(new InputStreamReader(new FileInputStream(file), "UTF-8"));
    String buffer;
...
StringreadFile(File file)
read File
StringBuffer contents = new StringBuffer();
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) {
        contents.append(line);
...
StringreadFile(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();
StringreadFile(File file)
Reads given file and returns file contents
String fileStr = "";
String strLineCurrent = "";
try {
    FileInputStream fstream = new FileInputStream(file);
    DataInputStream in = new DataInputStream(fstream);
    BufferedReader br = new BufferedReader(new InputStreamReader(in));
    while ((strLineCurrent = br.readLine()) != null) {
        fileStr = fileStr + strLineCurrent + "\n";
...
StringreadFile(File file)
read File
final BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(file), "UTF-8"));
try {
    String tmp = in.readLine();
    final StringBuilder sb = new StringBuilder(tmp != null ? tmp : ""); 
    while ((tmp = in.readLine()) != null) {
        sb.append(System.getProperty("line.separator")); 
        sb.append(tmp);
    return sb.toString();
} finally {
    if (in != null) {
        in.close();
StringreadFile(File file)
read File
final char[] buffer = new char[BUFFER];
final StringBuilder out = new StringBuilder();
try (final Reader in = new InputStreamReader(new FileInputStream(file), "UTF-8")) {
    return readFromStream(buffer, out, in);
StringreadFile(File file)
read File
StringBuilder sb = new StringBuilder();
BufferedReader reader = null;
try {
    reader = new BufferedReader(new InputStreamReader(new FileInputStream(file), ENCODING));
    String lineStr = null;
    while ((lineStr = reader.readLine()) != null) {
        sb.append(lineStr + "\n");
} finally {
    reader.close();
return sb.toString();
StringreadFile(File file, String default_encoding)
read File
FileInputStream fileInputStream = new FileInputStream(file);
try {
    StringBuilder returnVal = new StringBuilder((int) file.length());
    BufferedInputStream in = new BufferedInputStream(fileInputStream);
    in.mark(3);
    Reader reader = new InputStreamReader(in, consumeBOM(in, default_encoding));
    char[] line = new char[2000];
    int count = 0;
...
StringreadFile(File file, String encoding)
read File
long length = file.length();
if (length > Integer.MAX_VALUE) {
return readFile(new FileInputStream(file), file.getName(), encoding, length);
StringreadFile(File file, String encoding)
read File
String fileContent = "";
try {
    if (file.isFile() && file.exists()) {
        InputStreamReader read = new InputStreamReader(new FileInputStream(file), encoding);
        BufferedReader reader = new BufferedReader(read);
        String line;
        while ((line = reader.readLine()) != null) {
            fileContent += line;
...