Closeable, AutoCloseablepublic class SubInputStream extends FilterInputStream
This InputStream can be used to read chunks from a larger file of which the length is known in advance.
in| Constructor | Description |
|---|---|
SubInputStream(InputStream in,
long maxLen) |
Creates a new SubInputStream.
|
SubInputStream(InputStream in,
long maxLen,
boolean closeUnderlying) |
Creates a new SubInputStream.
|
| Modifier and Type | Method | Description |
|---|---|---|
void |
close() |
|
int |
read() |
|
int |
read(byte[] b,
int off,
int len) |
|
long |
skip(long n) |
available, mark, markSupported, read, resetreadAllBytes, readNBytes, transferTopublic SubInputStream(InputStream in, long maxLen, boolean closeUnderlying)
in - the InputStream to read frommaxLen - the maximum number of bytes to read from the underlying InputStream until
the end-of-file is signalled.closeUnderlying - true if the underlying stream should be closed when the
close() method is called.public SubInputStream(InputStream in, long maxLen)
in - the InputStream to read frommaxLen - the maximum number of bytes to read from the underlying InputStream until
the end-of-file is signalled.public int read()
throws IOException
read in class FilterInputStreamIOExceptionpublic int read(byte[] b,
int off,
int len)
throws IOException
read in class FilterInputStreamIOExceptionpublic long skip(long n)
throws IOException
skip in class FilterInputStreamIOExceptionpublic void close()
throws IOException
close in interface AutoCloseableclose in interface Closeableclose in class FilterInputStreamIOExceptionCopyright © 2018 Apache Software Foundation. All rights reserved.