Module net.shibboleth.ext.spring
Class HTTPResource.ConnectionClosingInputStream
- java.lang.Object
-
- java.io.InputStream
-
- net.shibboleth.ext.spring.resource.HTTPResource.ConnectionClosingInputStream
-
- All Implemented Interfaces:
Closeable,AutoCloseable
- Enclosing class:
- HTTPResource
private static class HTTPResource.ConnectionClosingInputStream extends InputStream
A wrapper around the entity contentInputStreamrepresented by anHttpResponsethat closes the stream and the HttpResponse whenclose()is invoked.
-
-
Field Summary
Fields Modifier and Type Field Description private org.apache.http.HttpResponseresponseHTTP response that is being wrapped.private InputStreamstreamStream owned by the given HTTP response.
-
Constructor Summary
Constructors Constructor Description ConnectionClosingInputStream(org.apache.http.HttpResponse httpResponse)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intavailable()voidclose()voidmark(int readLimit)booleanmarkSupported()intread()intread(byte[] b)intread(byte[] b, int off, int len)voidreset()longskip(long n)-
Methods inherited from class java.io.InputStream
nullInputStream, readAllBytes, readNBytes, readNBytes, transferTo
-
-
-
-
Field Detail
-
response
private final org.apache.http.HttpResponse response
HTTP response that is being wrapped.
-
stream
private final InputStream stream
Stream owned by the given HTTP response.
-
-
Constructor Detail
-
ConnectionClosingInputStream
public ConnectionClosingInputStream(@Nonnull org.apache.http.HttpResponse httpResponse) throws IOExceptionConstructor.- Parameters:
httpResponse- HTTP method that was invoked- Throws:
IOException- if there is a problem getting the entity content input stream from the response
-
-
Method Detail
-
available
public int available() throws IOException- Overrides:
availablein classInputStream- Throws:
IOException
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classInputStream- Throws:
IOException
-
mark
public void mark(int readLimit)
- Overrides:
markin classInputStream
-
markSupported
public boolean markSupported()
- Overrides:
markSupportedin classInputStream
-
read
public int read() throws IOException- Specified by:
readin classInputStream- Throws:
IOException
-
read
public int read(byte[] b) throws IOException- Overrides:
readin classInputStream- Throws:
IOException
-
read
public int read(byte[] b, int off, int len) throws IOException- Overrides:
readin classInputStream- Throws:
IOException
-
reset
public void reset() throws IOException- Overrides:
resetin classInputStream- Throws:
IOException
-
skip
public long skip(long n) throws IOException- Overrides:
skipin classInputStream- Throws:
IOException
-
-