public void reset() throws IOException {
        abortIfNeeded();
        if (bytesReadPastMark <= bufferSize) {
            if (log.isDebugEnabled()) {
                log.debug("Reset after reading " + bytesReadPastMark + " bytes.");
            }
            bufferOffset = 0;
        } else {
            throw new IOException(
                "Input stream cannot be reset as " + this.bytesReadPastMark
                + " bytes have been written, exceeding the available buffer size of " + this.bufferSize);
        }
    }
Resets the input stream to the beginning by pointing the buffer offset to
the beginning of the available data buffer.

@throws IOException
            When the available buffer size has been exceeded, in which
            case the input stream data cannot be repeated.
aws-java-sdk-s3/src/main/java/com/amazonaws/services/s3/internal/RepeatableInputStream.java