@Override
  public synchronized void reset() throws IOException {
    if (readLimit == -1 || mark == -1) {
      throw new IOException("Mark not set before reset invoked.");
    }
    if (byteBuffer.position() - mark > readLimit) {
      throw new IOException("Read limit exceeded before reset invoked.");
    }
    byteBuffer.reset();
  }
Reads 'size' amount of bytes from the stream into the buffer.
@param stream The stream from which bytes need to be read. If the underlying stream is SocketInputStream, it needs
              to be blocking.
@param size The size that needs to be read from the stream
@throws IOException
ambry-utils/src/main/java/com/github/ambry/utils/ByteBufferInputStream.java