private void triggerError() throws FakeIOException {
        if (currNumErrors >= maxNumErrors)
            return;

        if (position >= bytesReadBeforeException) {
            if (resetIntervalBeforeException > 0
            &&  resetCount % resetIntervalBeforeException != (resetIntervalBeforeException-1))
                return;
            currNumErrors++;
            if (isFakeIOException)
                throw new FakeIOException("Fake IO error " + currNumErrors
                    + " on UnreliableFileInputStream: " + this);
            else
                throw new RuntimeException("Injected runtime error " + currNumErrors
                        + " on UnreliableFileInputStream: " + this);
        }
    }
used to control whether an exception would be thrown based on the reset
recurrence; not applicable if set to zero. For example, if
resetIntervalBeforeException == n, the exception can only be thrown
before the n_th reset (or after the n_th minus 1 reset), 2n_th reset (or
after the 2n_th minus 1) reset), etc.
aws-java-sdk-core/src/main/java/com/amazonaws/util/UnreliableFilterInputStream.java