Class EofSensorInputStream

java.lang.Object
java.io.InputStream
org.apache.hc.core5.http.io.EofSensorInputStream
All Implemented Interfaces:
Closeable, AutoCloseable

public class EofSensorInputStream extends InputStream
A stream wrapper that triggers actions on close() and EOF. Primarily used to auto-release an underlying managed connection when the response body is consumed or no longer needed.
Since:
4.0
See Also:
  • Constructor Details

    • EofSensorInputStream

      public EofSensorInputStream(InputStream in, EofSensorWatcher watcher)
      Creates a new EOF sensor. If no watcher is passed, the underlying stream will simply be closed when EOF is detected or close is called. Otherwise, the watcher decides whether the underlying stream should be closed before detaching from it.
      Parameters:
      in - the wrapped stream
      watcher - the watcher for events, or null for auto-close behavior without notification
  • Method Details