code: private void readInput() {
          if (buf.limit() == buf.capacity())
              makeSpace();
  
          // Prepare to receive data
          int p = buf.position();
          buf.position(buf.limit());
          buf.limit(buf.capacity());
  
          int n = 0;
          try {
              n = source.read(buf);
          } catch (IOException ioe) {
              lastException = ioe;
              n = -1;
          }
  
          if (n == -1) {
              sourceClosed = true;
              needInput = false;
          }
  
          if (n > 0)
              needInput = false;
  
          // Restore current position and limit for reading
          buf.limit(buf.position());
          buf.position(p);
          // Android-changed: The matcher implementation eagerly calls toString() so we'll have
          // to update its input whenever the buffer limit, position etc. changes.
          matcher.reset(buf);
      }
docs: Tries to read more input. May block.