Java Utililty Methods BufferedReader Read

List of utility methods to do BufferedReader Read

Description

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

Method

StringreadFile(String filename)
Function that reads a file from disk to a String
BufferedReader in = new BufferedReader(new FileReader(filename));
String line;
StringBuffer buffer = new StringBuffer();
while ((line = in.readLine()) != null) {
    buffer.append(line);
return buffer.toString();
StringreadFile(String fileName)
read File
return readAll(new FileReader(fileName));
StringreadFile(String fileName)
read File
BufferedReader br = new BufferedReader(new FileReader(fileName));
try {
    StringBuilder sb = new StringBuilder();
    String line = br.readLine();
    while (line != null) {
        sb.append(line);
        sb.append("\n");
        line = br.readLine();
...
StringreadFile(String filename)
read File
String readString = "";
String tmp;
File f = new File(filename);
char[] readIn = new char[(new Long(f.length())).intValue()];
BufferedReader in = new BufferedReader(new FileReader(f));
in.read(readIn);
readString = new String(readIn);
in.close();
...
StringreadFile(String filename)
read File
return readFile(new File(filename));
StringBuilderreadFile(String fileName)
read File
FileReader fr = new FileReader(fileName);
BufferedReader br = new BufferedReader(fr);
String s;
StringBuilder sb = new StringBuilder();
while ((s = br.readLine()) != null) {
    sb.append(s + "\r\n");
fr.close();
...
StringreadFile(String fileName)
read File
String retStr = "";
File f = new File(fileName);
try {
    BufferedReader br = new BufferedReader(new FileReader(f));
    StringBuffer buff = new StringBuffer();
    String line = br.readLine();
    while (line != null) {
        buff.append(line + NEW_LINE);
...
StringreadFile(String fileName)
read File
if (fileName == null)
    throw new IOException("filename is null");
FileReader fr = new FileReader(fileName);
BufferedReader br = new BufferedReader(fr);
StringBuilder buffer = new StringBuilder();
String nextLine;
while ((nextLine = br.readLine()) != null)
    buffer.append(nextLine).append("\n");
...
StringreadFile(String filename)
read File
StringBuilder s = new StringBuilder();
BufferedReader in = null;
try {
    in = new BufferedReader(new FileReader("infilename"));
    String str;
    while ((str = in.readLine()) != null) {
        s.append(str).append("\n"); 
} catch (IOException e) {
    e.printStackTrace();
} finally {
    try {
        in.close();
    } catch (IOException e) {
return s.toString();
StringreadFile(String fileName)
read File
if (!new File(fileName).exists()) {
    return "";
BufferedReader br = new BufferedReader(new FileReader(fileName));
try {
    StringBuilder sb = new StringBuilder();
    String line = br.readLine();
    while (line != null) {
...