private boolean readLine(InputStream in,StringBuffer buf) throws IOException {
  while (true) {
    int c=in.read();
    if (c < 0)     return (buf.length() > 0);
    if (c == '\r') {
      in.mark(1);
      c=in.read();
      if (c != '\n')       in.reset();
      return (true);
    }
    if (c == '\n')     return (true);
    buf.append((char)c);
  }
}

private boolean readLine ( InputStream in , StringBuffer buf ) throws IOException { while ( true ) { int c = in . read ( ) ; if ( c < 0 ) return ( buf . length ( ) > 0 ) ; if ( c == '\r' ) { in . mark ( 1 ) ; c = in . read ( ) ; if ( c != '\n' ) in . reset ( ) ; return ( true ) ; } if ( c == '\n' ) return ( true ) ; buf . append ( ( char ) c ) ; } }
read up to crlf , return false if eof
