Java Utililty Methods BufferedReader Read Line

List of utility methods to do BufferedReader Read Line

Description

The list of methods to do BufferedReader Read Line are organized into topic(s).

Method

StringreadLine(BufferedReader in)
read a line from "in", using readLine().
String line;
StringBuilder sb = null;
while ((line = in.readLine()) != null) {
    if (line.length() == 0) {
        break;
    } else if (line.charAt(line.length() - 1) == '\\') {
        if (sb == null)
            sb = new StringBuilder();
...
StringreadLine(BufferedReader in)
read Line
String nextLine = null;
while ((nextLine = in.readLine()) != null) {
    nextLine = nextLine.trim();
    if (nextLine.length() > 0 && !nextLine.matches("^//.*")) {
        return nextLine;
return null;
...
Stringreadline(BufferedReader in, BufferedReader err)
Read a line of text from the BufferedReader.
if (err != null && err.ready()) {
    String msg = err.readLine();
    if (msg.toLowerCase().indexOf("interrupt") >= 0) {
        throw new InterruptedException("");
    } else {
        System.out.println("ERR:" + msg);
        throw new IOException(msg);
char buff[] = new char[BUFF_SIZE];
String result = null;
int go_back = 0;
int size = 0;
while (!in.ready()) {
for (size = 0; size < BUFF_SIZE; size++) {
    if (!in.ready()) {
        if (size == 0)
            return null;
    } else {
        buff[size] = (char) in.read();
        String charac = (new Character(buff[size])).toString();
        if (charac.equals("\n")) {
            go_back++;
            break;
        } else if (buff[size] == -1) {
            go_back++;
            break;
if (size < go_back)
    return "";
result = new String(buff, 0, size);
return result;
StringreadLine(BufferedReader input)
read Line
String line = input.readLine();
return line;
StringreadLine(BufferedReader reader)
read Line
int ch = -1;
StringBuffer line = new StringBuffer();
ch = reader.read();
while ((ch != -1) && (ch != 13) && (ch != 10)) {
    line.append((char) ch);
    ch = reader.read();
if ((ch == -1) && (line.length() == 0)) {
...
StringreadLine(BufferedReader reader)
Read a line from the reader
String line = reader.readLine();
if (line != null) {
    return line.trim();
return null;
StringreadLine(BufferedReader reader)
read Line
String result = null;
try {
    result = reader.readLine();
} catch (IOException e) {
    result = null;
return result;
booleanreadLine(BufferedReader reader, StringWriter writer)
read Line
boolean encounteredCr = false;
while (true) {
    int read = reader.read();
    if (read == -1) {
        return encounteredCr;
    if (read == '\r') {
        encounteredCr = true;
...
ListreadLine(File f)
read Line
List<String> result = new ArrayList<String>();
BufferedReader reader = null;
try {
    reader = new BufferedReader(new InputStreamReader(new FileInputStream(f), "utf-8"));
    String line = null;
    while ((line = reader.readLine()) != null)
        result.add(line);
} catch (Exception e) {
...
ListreadLine(File f)
read Line
try {
    return readLine(new FileInputStream(f));
} catch (FileNotFoundException e) {
    e.printStackTrace();
return null;