public boolean readLine ( Appendable buf ) throws IOException { boolean success = false ; while ( true ) { // Process buffer: while ( pos < end ) { success = true ; final char c = buffer [ pos ++ ] ; if ( c == ' ' ) { return success ; } if ( c == ' ' ) { continue ; } buf . append ( c ) ; } // Refill buffer: assert ( pos >= end ) : "Buffer wasn't empty when refilling!" ; end = in . read ( buffer , 0 , buffer . length ) ; pos = 0 ; if ( end < 0 ) { // End of stream. return success ; } } }
Read a line into the given buffer .