Package net.shibboleth.shared.spring.httpclient.resource

# Class ConnectionClosingInputStream

java.lang.Object
java.io.InputStream
net.shibboleth.shared.spring.httpclient.resource.ConnectionClosingInputStream

All Implemented Interfaces:
  `Closeable`, `AutoCloseable`

public class ConnectionClosingInputStream extends InputStream
A wrapper around the entity content `InputStream` represented by an `HttpResponse` that closes the stream and the HttpResponse when `close()` is invoked.

## Field Summary

Fields
Modifier and Type
Field
Description
`private final org.apache.hc.core5.http.ClassicHttpResponse`
`response`
HTTP response that is being wrapped.
`private final InputStream`
`stream`
Stream owned by the given HTTP response.

## Constructor Summary

Constructors
Constructor
Description
`ConnectionClosingInputStream(org.apache.hc.core5.http.ClassicHttpResponse httpResponse)`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`int`
`available()`
`void`
`close()`
`void`
`mark(int readLimit)`
`boolean`
`markSupported()`
`int`
`read()`
`int`
`read(byte[] b)`
`int`
`read(byte[] b, int off, int len)`
`void`
`reset()`
`long`
`skip(long n)`

### Methods inherited from class java.io.InputStream

`nullInputStream, readAllBytes, readNBytes, readNBytes, skipNBytes, transferTo`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### response

@Nonnull private final org.apache.hc.core5.http.ClassicHttpResponse response
HTTP response that is being wrapped.

### stream

@Nonnull private final InputStream stream
Stream owned by the given HTTP response.

## Constructor Details

### ConnectionClosingInputStream

public ConnectionClosingInputStream(@Nonnull org.apache.hc.core5.http.ClassicHttpResponse httpResponse) throws IOException
Constructor.

Parameters:
  `httpResponse` - HTTP method that was invoked
Throws:
  `IOException` - if there is a problem getting the entity content input stream from the response

## Method Details

### available

public int available() throws IOException

Overrides:
  `available` in class `InputStream`
Throws:
  `IOException`

### close

public void close() throws IOException

Specified by:
  `close` in interface `AutoCloseable`
Specified by:
  `close` in interface `Closeable`
Overrides:
  `close` in class `InputStream`
Throws:
  `IOException`

### mark

public void mark(int readLimit)

Overrides:
  `mark` in class `InputStream`

### markSupported

public boolean markSupported()

Overrides:
  `markSupported` in class `InputStream`

### read

public int read() throws IOException

Specified by:
  `read` in class `InputStream`
Throws:
  `IOException`

### read

public int read(byte[] b) throws IOException

Overrides:
  `read` in class `InputStream`
Throws:
  `IOException`

### read

public int read(byte[] b, int off, int len) throws IOException

Overrides:
  `read` in class `InputStream`
Throws:
  `IOException`

### reset

public void reset() throws IOException

Overrides:
  `reset` in class `InputStream`
Throws:
  `IOException`

### skip

public long skip(long n) throws IOException

Overrides:
  `skip` in class `InputStream`
Throws:
  `IOException`