protected final boolean readAvailableBlocking() throws IOException {
  char[] buffer=myBuffer;
  StringBuilder token=myTextBuffer;
  token.setLength(0);
  boolean read=false;
  int n;
  while ((n=myReader.read(buffer)) > 0) {
    if (myScheduledSubmitter != null)     myScheduledSubmitter.cancel(true);
    read=true;
synchronized (myTextBuffer) {
      processLine(buffer,token,n);
    }
    myScheduledSubmitter=myExecutorService.submit(myTokenSubmitter);
  }
  submitToken();
  return read;
}

protected final boolean readAvailableBlocking ( ) throws IOException { char [ ] buffer = myBuffer ; StringBuilder token = myTextBuffer ; token . setLength ( 0 ) ; boolean read = false ; int n ; while ( ( n = myReader . read ( buffer ) ) > 0 ) { if ( myScheduledSubmitter != null ) myScheduledSubmitter . cancel ( true ) ; read = true ; synchronized ( myTextBuffer ) { processLine ( buffer , token , n ) ; } myScheduledSubmitter = myExecutorService . submit ( myTokenSubmitter ) ; } submitToken ( ) ; return read ; }
reads data with blocking . should be used in case when ready method always returns false for your input stream . should be used if we want to to make our reader exit when end of stream reached . could be used if we prefer io - blocking over cpu sleeping .
