@ Nonnull public List < String > getRemainingLines ( boolean trimAndSkipEmpty ) throws IOException { List < String > out = new ArrayList <> ( ) ; StringBuilder builder = new StringBuilder ( ) ; while ( bufferOffset <= bufferLimit || ! bufferLineEnd ) { if ( ! readNextChar ( ) ) { break ; } if ( lastChar == ' ' ) { String line = builder . toString ( ) ; if ( ! trimAndSkipEmpty || ! line . trim ( ) . isEmpty ( ) ) { out . add ( trimAndSkipEmpty ? line . trim ( ) : line ) ; } builder = new StringBuilder ( ) ; } else { builder . append ( ( char ) lastChar ) ; } } if ( builder . length ( ) > 0 ) { String line = builder . toString ( ) ; if ( ! trimAndSkipEmpty || ! line . trim ( ) . isEmpty ( ) ) { out . add ( builder . toString ( ) ) ; } } return out ; }
Read the rest of input from the reader and get the lines from there . This will consume the rest of the content of the reader .