All pastes #362126 Raw Edit

Untitled

public text v1 · immutable
·published 2007-02-18 15:31 UTC
rendered paste body
import java.io.*;

public class LineReader extends InputStreamReader
{
        public LineReader(InputStream is)
        {
                super(is);
        }

        public String readLine() throws IOException
        {
                String line = "";
                int count = 0;

                for (;;) {
                        int i = read();
                        if (i == -1) {
                                if (count == 0)
                                        return null;
                                else
                                        return line;
                        }
                        else if (i == '\n') {
                                return line;
                        }
                        line += (char)i;
                        count++;
                }
        }
}