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

ListreadFileAsListOfString(String fileName, String splitBy)
read File As List Of String
File file = new File(fileName);
BufferedReader buffer = new BufferedReader(new FileReader(file));
String line;
List<String> data = new ArrayList<>();
while ((line = buffer.readLine()) != null) {
    data = Arrays.asList(line.split(splitBy));
return data;
...
ListreadFileAsListOfStrings(String filename)
Open and read a file, and return the lines in the file as a list of Strings.
List<String> records = new ArrayList<String>();
try {
    BufferedReader reader = new BufferedReader(new FileReader(filename));
    String line;
    while ((line = reader.readLine()) != null) {
        records.add(line);
    reader.close();
...
ListreadFileAsListOfStrings(String filename)
Open and read a file, and return the lines in the file as a list of Strings.
List<String> records = new ArrayList<String>();
BufferedReader reader = new BufferedReader(new FileReader(filename));
String line;
while ((line = reader.readLine()) != null) {
    records.add(line);
reader.close();
return records;
...
StringreadFileAsText(String path)
read File As Text
FileReader reader = new FileReader(path);
BufferedReader br = new BufferedReader(reader);
try {
    String text = "";
    String line = null;
    while ((line = br.readLine()) != null) {
        text = text + line + "\n";
    return text;
} finally {
    br.close();
    reader.close();
SetreadFileByChar(String path)
read File By Char
Set<String> datas = new HashSet<String>();
FileReader fr = new FileReader(path);
BufferedReader br = new BufferedReader(fr);
String line = null;
while ((line = br.readLine()) != null) {
    datas.add(line);
br.close();
...
StringreadFileContext(File fileToRead)

Read the context of a file.

try {
    BufferedReader bf = new BufferedReader(new FileReader(fileToRead));
    StringBuffer sb = new StringBuffer();
    String aline = bf.readLine();
    while (aline != null) {
        sb.append(aline);
        sb.append(LINE_SEP);
        aline = bf.readLine();
...
StringreadFileEncoding(String file)
read File Encoding
FileReader fr;
String encoding = null;
try {
    fr = new FileReader(file);
    BufferedReader br = new BufferedReader(fr);
    char[] buffer = new char[100];
    br.read(buffer);
    StringBuffer st = new StringBuffer(new String(buffer));
...
booleanreadFileGdeHash(File gdeFile, ArrayList name, ArrayList seq)
read File Gde Hash
return readFastaFileToArray(gdeFile, "#", name, seq);
StringreadFilePathToString(String filePath)
read File Path To String
StringBuffer fileData = new StringBuffer(2048);
BufferedReader reader = new BufferedReader(new FileReader(filePath));
char[] buf = new char[1024];
int numRead = 0;
while ((numRead = reader.read(buf)) != -1) {
    String readData = String.valueOf(buf, 0, numRead);
    fileData.append(readData);
    buf = new char[1024];
...
LinkedHashMapreadFileToHashMap(String filePath, String separator, boolean valueFirst)
Method to read a properties file into a LinkedHashMap .
if (separator == null) {
    separator = "=";
List<String> lines = readFileToLinesList(filePath);
LinkedHashMap<String, String> propertiesMap = new LinkedHashMap<>();
for (String line : lines) {
    line = line.trim();
    if (line.length() == 0) {
...