Class HttpMethodReleaseInputStream

  • All Implemented Interfaces:
    Closeable, AutoCloseable, InputStreamWrapper

    public class HttpMethodReleaseInputStream
    extends InputStream
    implements InputStreamWrapper
    Utility class to wrap InputStreams obtained from an HttpClient library's HttpMethod object, and ensure the stream and HTTP connection is cleaned up properly.

    This input stream wrapper is used to ensure that input streams obtained through HttpClient connections are cleaned up correctly once the caller has read all the contents of the connection's input stream, or closed that input stream.

    Important! This input stream must be completely consumed or closed to ensure the necessary cleanup operations can be performed.

    Author:
    James Murty
    • Constructor Detail

      • HttpMethodReleaseInputStream

        public HttpMethodReleaseInputStream​(org.apache.commons.httpclient.HttpMethod httpMethod)
        Constructs an input stream based on an HttpMethod object representing an HTTP connection. If a connection input stream is available, this constructor wraps the underlying input stream in an InterruptableInputStream and makes that stream available. If no underlying connection is available, an empty ByteArrayInputStream is made available.
        Parameters:
        httpMethod -