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(File file)
read Line
try (BufferedReader br = new BufferedReader(new FileReader(file))) {
    return br.readLine();
StringreadLine(File file, int lineNumber)
Reads a line from the specified file and lineNumber.
List<String> records = readRecords(file);
return records.get(lineNumber);
ListreadLine(InputStream in)
read Line
return readLine(in, "utf-8");
StringreadLine(InputStream in)
read Line
final BufferedReader reader = new BufferedReader(new InputStreamReader(in));
final StringBuilder out = new StringBuilder();
final String newLine = System.getProperty("line.separator");
String line;
try {
    while ((line = reader.readLine()) != null) {
        out.append(line);
        out.append(newLine);
...
StringreadLine(InputStream input)
Cheesy method which lets us read from an InputStream without having to instantiate a BufferedReader.
StringBuilder buf = new StringBuilder();
int c;
while ((c = input.read()) >= 0 && c != '\n') {
    buf.append((char) c);
return c >= 0 ? buf.toString() : null;
StringreadLine(InputStream input)
Cheesy method which lets us read from an InputStream without having to instantiate a BufferedReader.
StringBuilder buf = new StringBuilder();
int c;
while ((c = input.read()) >= 0 && c != '\n') {
    buf.append((char) c);
return c >= 0 ? buf.toString() : null;
StringreadLine(RandomAccessFile wiki)
read Line
long start = wiki.getFilePointer();
wiki.readLine();
long end = wiki.getFilePointer();
wiki.seek(start);
byte[] b = new byte[(int) (end - start)];
wiki.read(b);
return new String(b).replace(System.lineSeparator(), "");
StringreadLine(Reader rd)
Read a line from an InputStream in human-readable-form as a String.
String input = "";
while (!Thread.interrupted()) {
    int ch = rd.read();
    if (ch == -1)
        if ("".equals(input))
            return null;
        else
            break;
...
StringreadLine(String fileName)
read Line
FileReader fr = new FileReader(fileName);
BufferedReader br = new BufferedReader(fr);
return br.readLine();
StringreadLine(String fileName)
read Line
if (fileName == null) {
    return null;
BufferedReader in = null;
try {
    in = new BufferedReader(new FileReader(fileName));
    String str = in.readLine();
    if (str != null) {
...