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

StringloadJson(String path)
load Json
BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(path), "UTF-8"));
StringBuilder stringBuilder = new StringBuilder();
String line = null;
while ((line = reader.readLine()) != null) {
    stringBuilder.append(line);
return stringBuilder.toString();
Map>>loadKey(String filename)
Loads a key file returning a mapping from each term to its instances, where an instance is a mapping from an instance key to the graded senses that were present in that instance.
return loadKey(new File(filename));
int[]loadLastExpInfo(String lastExpFileName)
load Last Exp Info
int num_user = 0;
int type_spd = 0;
int exp_id = 0;
String line;
File lastExpFile = new File(lastExpFileName);
FileReader expFileReader = new FileReader(lastExpFile);
BufferedReader expBufferedReader = new BufferedReader(expFileReader);
try {
...
StringloadLine(InputStream load)
load Line
try {
    DataInputStream bis = new DataInputStream(load);
    BufferedReader br = new BufferedReader(new InputStreamReader(bis));
    return br.readLine();
} finally {
    load.close();
ListloadLineByLineAndTrim(String file_path)
load Line By Line And Trim
List<String> lines = new ArrayList<String>();
try {
    File f = new File(file_path);
    if (!f.exists())
        return lines;
    BufferedReader br1 = new BufferedReader(new FileReader(f));
    while (br1.ready()) {
        String line = br1.readLine();
...
voidloadLines(InputStream in, List lines)
Loads the entire stream into memory as a String and returns it.
InputStreamReader isr = new InputStreamReader(in);
try {
    BufferedReader reader = new LineNumberReader(isr);
    while (true) {
        String line = reader.readLine();
        if (line != null) {
            lines.add(line);
        } else {
...
ListloadLines(String file)
Load the lines from a local text file into a list of strings.
ArrayList<String> rows = new ArrayList<>();
try (BufferedReader reader = new BufferedReader(new FileReader(file))) {
    String line;
    while ((line = reader.readLine()) != null) {
        rows.add(line);
} catch (IOException e) {
    System.err.println("Detected and error while reading file: " + file);
...
ListloadLines(String fileName)
Load lines.
List<String> lineList = new ArrayList<String>();
FileReader fr = new FileReader(fileName);
BufferedReader br = new BufferedReader(fr);
String line = null;
do {
    line = br.readLine();
    if (line != null) {
        lineList.add(line);
...
ListloadList(File f, String enc)
load List
List<String> ret = new ArrayList<String>();
BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(f), enc));
try {
    String line = null;
    while ((line = br.readLine()) != null) {
        ret.add(line);
} finally {
...
HashSetloadList(final File file)
load List
final HashSet<String> set = new HashSet<String>();
BufferedReader br = null;
try {
    br = new BufferedReader(new InputStreamReader(new FileInputStream(file)));
    String line;
    while ((line = br.readLine()) != null) {
        line = line.trim();
        if (line.length() > 0 && line.charAt(0) != '#') {
...