Class LimitedInputStream

  • All Implemented Interfaces:
    Closeable, AutoCloseable

    public abstract class LimitedInputStream
    extends FilterInputStream
    Wraps a InputStream, limiting the number of bytes which can be read. This class was copied and modifed from the Google Guava 16.0. Differently from the original Guava code, when a caller tries to read from this stream past the given limit and the wrapped stream hasn't yet reached its EOF this class will call the limitExceeded method instead of returning EOF.