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

HashMapreadFileToHashMap(String filePath, String separator, boolean valueFirst)
Method to read a properties file into a HashMap .
if (separator == null) {
    separator = "=";
List<String> lines = readFileToLinesList(filePath);
HashMap<String, String> propertiesMap = new HashMap<String, String>();
for (String line : lines) {
    line = line.trim();
    if (line.length() == 0) {
...
voidreadFileToList(String fileName, List list)
read File To List
readFileToList(new File(fileName), list);
ListreadFileToList(String path, String split)
Reads contents of files and splits it into an array by List object
List<String> tmp = new ArrayList<String>();
String[] array = readFile(path).split(split);
for (int i = 0; i < array.length; i++) {
    tmp.add(array[i]);
return tmp;
ListreadFileToListOfStrings(File file)
read File To List Of Strings
List<String> strings = new LinkedList<>();
BufferedReader reader = null;
try {
    reader = new BufferedReader(new FileReader(file));
    String line;
    while ((line = reader.readLine()) != null) {
        line = line.replaceAll("\r", "").replaceAll("\n", "").replaceAll(" ", "");
        strings.add(line);
...
StringreadFileValue(File file)
read File Value
BufferedReader reader = null;
String line = null;
try {
    FileReader fr = new FileReader(file);
    reader = new BufferedReader(fr);
    line = reader.readLine();
} finally {
    if (reader != null) {
...
StringreadFileWithoutLineBreak(String filename, boolean skipEmptyLine)
read File Without Line Break
StringBuilder sb = new StringBuilder();
BufferedReader br = new BufferedReader(new FileReader(filename));
try {
    String line;
    while ((line = br.readLine()) != null) {
        if (skipEmptyLine && line.trim().length() == 0) {
            continue;
        sb.append(line);
} finally {
    br.close();
return sb.toString();