public class AutoCloseInputStream extends FilterInputStream
in| Constructor and Description |
|---|
AutoCloseInputStream(InputStream in)
Create a new auto closing stream for the provided connection
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close the stream, and also close the underlying stream if it is not
already closed.
|
int |
read()
Reads the next byte of data from the input stream.
|
int |
read(byte[] b)
Reads some number of bytes from the input stream and stores them into the
buffer array b.
|
int |
read(byte[] b,
int off,
int len)
Reads up to
len bytes of data from the stream. |
available, mark, markSupported, reset, skippublic AutoCloseInputStream(InputStream in)
in - the input stream to read frompublic int read()
throws IOException
read in class FilterInputStreamIOException - when there is an error readingpublic int read(byte[] b,
int off,
int len)
throws IOException
len bytes of data from the stream.read in class FilterInputStreamb - a byte array to read data intooff - an offset within the array to store datalen - the maximum number of bytes to readIOException - if there are errors readingpublic int read(byte[] b)
throws IOException
read in class FilterInputStreamb - a byte array to read data intoIOException - if there are errors readingpublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in class FilterInputStreamIOException - If an IO problem occurs.Copyright © 2019. All rights reserved.