Java InputStreamReader Read Line readLine(InputStreamReader reader)

Here you can find the source of readLine(InputStreamReader reader)

Description

Reads a line from a reader.

License

Open Source License

Declaration

public static String readLine(InputStreamReader reader) throws IOException 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
    /** Reads a line from a reader. */
    public static String readLine(InputStreamReader reader) throws IOException {
        int c = reader.read();
        if (c == -1) {
            return null;
        }//  www . ja va 2 s  .co  m
        StringBuffer line = new StringBuffer();
        while (c != -1 && c != '\n') {
            if (c != '\r') {
                line.append((char) c);
            }
            c = reader.read();
        }
        return line.toString();
    }
}

Related

  1. readLine(InputStreamReader is)
  2. readLineList(InputStream stream)