private boolean tryToEnsureNumberOfBytesInBuffer(int minCapacity) throws IOException {
  while (buffer.size() <= minCapacity && !eof) {
    eof=inChannel.read(readBuffer) == -1;
    readBuffer.flip();
    buffer=buffer.concat(ByteString.copyFrom(readBuffer));
    readBuffer.clear();
  }
  return buffer.size() >= minCapacity;
}

private boolean tryToEnsureNumberOfBytesInBuffer ( int minCapacity ) throws IOException { while ( buffer . size ( ) <= minCapacity && ! eof ) { eof = inChannel . read ( readBuffer ) == - 1 ; readBuffer . flip ( ) ; buffer = buffer . concat ( ByteString . copyFrom ( readBuffer ) ) ; readBuffer . clear ( ) ; } return buffer . size ( ) >= minCapacity ; }
returns false if we were unable to ensure the minimum capacity by consuming the channel .
