Java Reader Read Line readLines(Reader reader)

Here you can find the source of readLines(Reader reader)

Description

read Lines

License

Apache License

Declaration

public static String readLines(Reader reader) throws IOException 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.io.BufferedReader;
import java.io.IOException;

import java.io.Reader;

public class Main {
    public static String readLines(Reader reader) throws IOException {
        BufferedReader buf = new BufferedReader(reader);
        StringBuilder string = new StringBuilder();
        String line = buf.readLine();
        while (line != null) {
            string.append(line);//w  ww.  j ava  2  s  .  c om
            line = buf.readLine();
            if (line != null) {
                string.append("\n");
            }
        }
        return string.toString();
    }
}

Related

  1. readLines(Reader r, List lines)
  2. readLines(Reader reader)
  3. readLines(Reader reader)
  4. readLines(Reader reader)
  5. readLines(Reader reader)
  6. readLinesFromReader(final Reader reader)
  7. readLinesToList(BufferedReader bufferedReader)
  8. readLinesTrimmedNoCommmentFromBufferedReader(final BufferedReader in, final String commentString)
  9. readLinesWithContinuation(BufferedReader rdr, StringBuilder sb, int maxSize)