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

StringloadSQLFromFile(String fileName)

Loads teh content of SQL statement from the specified file.

BufferedReader reader = new BufferedReader(new FileReader(fileName));
String line;
StringBuilder sql = new StringBuilder();
try {
    while ((line = reader.readLine()) != null) {
        sql.append(line).append(" ");
} finally {
...
ArrayListloadStream(InputStream is)
load Stream
ArrayList<String> list = new ArrayList<String>();
BufferedReader tis = new BufferedReader(new InputStreamReader(is));
String str = tis.readLine();
while (str != null) {
    list.add(str);
    str = tis.readLine();
tis.close();
...
StringloadStreamContent(InputStream stream)
Loads a file into string
StringBuilder content = new StringBuilder();
BufferedReader reader = new BufferedReader(new InputStreamReader(stream, "UTF-8"));
try {
    char[] buff = new char[1024];
    int i = 0;
    while ((i = reader.read(buff)) != -1) {
        content.append(buff, 0, i);
} finally {
    reader.close();
return content.toString();
voidloadSystemClassPath()
load System Class Path
try {
    File file = new File("../classpath.txt");
    if (!file.exists())
        return;
    BufferedReader bf = new BufferedReader(new FileReader("../classpath.txt"));
    syspath = bf.readLine();
    System.out.println(syspath);
    File pfile = new File(syspath);
...
voidloadTableList(List list, String fileName)
Loads table list file and fill a list.
File file = new File(fileName);
if (file.exists()) {
    BufferedReader in = new BufferedReader(new FileReader(file));
    String line;
    while ((line = in.readLine()) != null) {
        line = line.trim();
        if (line.length() > 0) {
            list.add(line);
...
StringloadTemplate(final String resource)
Loads the specified resource file and returns it as String.
final InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream(resource);
final StringBuilder ret = new StringBuilder();
readerToBuilder(new InputStreamReader(is), ret);
return ret.toString();
StringloadTemplate(String templateUrl)
load Template
try (InputStream input = Thread.currentThread().getContextClassLoader().getResourceAsStream(templateUrl)) {
    if (input == null) {
        throw new IOException("Could not find template at location: " + templateUrl);
    try (BufferedReader reader = new BufferedReader(new InputStreamReader(input))) {
        StringBuilder stringBuilder = new StringBuilder();
        String line = null;
        while ((line = reader.readLine()) != null) {
...
MaploadTemplateParametersFile(File f)
load Template Parameters File
Map<String, String> toret = new HashMap<String, String>();
BufferedReader br;
try {
    br = new BufferedReader(new FileReader(f));
} catch (FileNotFoundException e1) {
    return toret;
if (!f.exists()) {
...
StringloadTestFixture(String path)
Loads the contents of the test fixture specified at the given path.
BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(path)));
StringBuilder sb = new StringBuilder();
String line;
while ((line = br.readLine()) != null) {
    sb.append(line);
return sb.toString();
int[]loadTestUserEventRelation(String eventFilePath, HashMap> TestUser2EventIndexSetMap)
Build TestUser2EventIndexSetMap and TestUserIndices.
if (!new File(eventFilePath).exists()) {
    System.err.println(String.format("Event file %s doesn't exist.\n", eventFilePath));
    exit(1);
BufferedReader br = null;
try {
    br = new BufferedReader(new FileReader(eventFilePath));
} catch (FileNotFoundException e) {
...