private int onException(Exception e) throws IOException {
        eofReached = true;
        if (e instanceof IOException) {
            throw (IOException) e;
        } else if (e instanceof RuntimeException) {
            throw (RuntimeException) e;
        } else {
            // Impossible since InputStream throws no other checked exceptions.
            throw Throwables.failure(e);
        }
    }
Marks the input stream as EOF since no further reads should be done.

@param e Exception thrown by delegate stream.
@return Noting, just for return signature.
@throws IOException or {@link RuntimeException}
aws-java-sdk-s3/src/main/java/com/amazonaws/services/s3/internal/S3AbortableInputStream.java