code: private int internalReadBytes(final int length) throws IOException {
  
          if (length > localCapacity) {
              throw new IllegalArgumentException("Length is larger than buffer. Request=" + length + ", capacity=" + localCapacity);
          }
  
          // check if we already have enough bytes available for reading
          // and if so, just return the length the user is asking for
          if (checkReadableBytesSafe(length)) {
              return length;
          }
  
          return readFromStream(length - getReadableBytes());
  
      }
docs: Ensure that <code>length</code> more bytes are available in the internal
  buffer. Read more bytes from the underlying stream if needed. This
  method is blocking in case we don't have enough bytes to read.
  
  @param length the amount of bytes we wishes to read
  @return the actual number of bytes read.
  @throws IOException