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 filePath)
read File
BufferedReader reader = null;
FileReader fileReader = null;
StringBuilder stringBuilder;
String line;
String ls;
try {
    stringBuilder = new StringBuilder();
    fileReader = new FileReader(filePath);
...
StringreadFile(String filePath)
Read text from a file in one line.
return readFile(new File(filePath));
StringreadFile(String filePath)
read File
try {
    BufferedReader br = new BufferedReader(new FileReader(new File(filePath)));
    StringBuffer sb = new StringBuffer();
    String line = null;
    while ((line = br.readLine()) != null) {
        sb.append(line + "\n");
    return sb.toString();
...
StringreadFile(String filePath, Boolean replaceNewLineWithBr)
read File
String result = null;
BufferedReader br = new BufferedReader(new FileReader(filePath));
StringBuilder sb = new StringBuilder();
String line = br.readLine();
while (line != null) {
    sb.append(line);
    if (replaceNewLineWithBr) {
        sb.append("<br>");
...
StringreadFile(String fullPath)
read File
return readFile(new File(fullPath));
StringreadFile(String fullPath)
read File
BufferedReader reader = new BufferedReader(new FileReader(fullPath));
if (reader == null)
    return null;
StringBuilder builder = new StringBuilder("");
String line = null;
while ((line = reader.readLine()) != null) {
    builder.append(line + "/n");
return builder.toString();
StringreadFile(String nameFile)
read File
StringBuilder sb = new StringBuilder("");
BufferedReader br = null;
try {
    br = new BufferedReader(new FileReader(nameFile));
    String linea;
    while ((linea = br.readLine()) != null) {
        sb.append(linea);
} catch (Exception e) {
    System.out.println(e.getMessage());
} finally {
    br.close();
return sb.toString();
StringreadFile(String path)
read File
StringBuilder text = new StringBuilder();
BufferedReader reader = null;
try {
    reader = new BufferedReader(new FileReader(path));
    String line;
    while ((line = reader.readLine()) != null)
        text.append(line).append("\n");
} catch (Exception ex) {
...
StringreadFile(String path)
Reads a file line after line.
FileReader reader = null;
BufferedReader buffReader = null;
StringBuilder text = new StringBuilder();
try {
    reader = new FileReader(path);
    buffReader = new BufferedReader(reader);
    String tempLine;
    while ((tempLine = buffReader.readLine()) != null) {
...
StringreadFile(String path)
read File
File file = new File(path);
FileReader fileReader = new FileReader(file);
BufferedReader bufferedReader = new BufferedReader(fileReader);
StringBuffer stringBuffer = new StringBuffer();
String str;
str = bufferedReader.readLine();
while (str != null) {
    stringBuffer.append(str);
...