Class AutoCloseableContentLengthVerifyingInputStream

  • All Implemented Interfaces:
    Closeable, AutoCloseable

    public class AutoCloseableContentLengthVerifyingInputStream
    extends ContentLengthVerifyingInputStream
    A wrapper over an InputStream whose length is known, which verifies that the length of the wrapped stream matches its known length and auto-closes the stream once the content length bytes of the stream have been read.

    This auto-close feature has been added to release the connection from the Apache connection pool which can otherwise lead to indefinite hangs

    NOTE: This implementation of auto closesable content length verification does not support InputStream.reset() and throws an IOException when reset is called