Package com.microsoft.azure.kusto.data
Class CloseParentResourcesStream
- java.lang.Object
-
- java.io.InputStream
-
- com.microsoft.azure.kusto.data.CloseParentResourcesStream
-
- All Implemented Interfaces:
Closeable,AutoCloseable
public class CloseParentResourcesStream extends InputStream
This class allows parent resources (HttpClient and HttpResponse) to be closed when the stream is closed. This becomes necessary when passing an InputStream externally, as postToStreamingOutput does. The parent resources must be closed, but this cannot happen until the InputStream is consumed. It takes a stream, and simply forwards the call to all of its methods, except for theclose()method - which does nothing.
-
-
Constructor Summary
Constructors Constructor Description CloseParentResourcesStream(org.apache.http.client.methods.CloseableHttpResponse httpResponse)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intavailable()voidclose()Closes all parent resources once the stream is closedvoidmark(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
-
-
-
-
Constructor Detail
-
CloseParentResourcesStream
public CloseParentResourcesStream(org.apache.http.client.methods.CloseableHttpResponse httpResponse) throws IOException- Throws:
IOException
-
-
Method Detail
-
close
public void close() throws IOExceptionCloses all parent resources once the stream is closed- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classInputStream- Throws:
IOException
-
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
-
skip
public long skip(long n) throws IOException- Overrides:
skipin classInputStream- Throws:
IOException
-
available
public int available() throws IOException- Overrides:
availablein classInputStream- Throws:
IOException
-
mark
public void mark(int readlimit)
- Overrides:
markin classInputStream
-
reset
public void reset() throws IOException- Overrides:
resetin classInputStream- Throws:
IOException
-
markSupported
public boolean markSupported()
- Overrides:
markSupportedin classInputStream
-
-