public 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 and 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 and Description |
---|---|
void |
close() |
int |
read() |
int |
read(byte[] b,
int off,
int len) |
long |
skip(long n) |
available, mark, markSupported, read, reset
public 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 FilterInputStream
IOException
public int read(byte[] b, int off, int len) throws IOException
read
in class FilterInputStream
IOException
public long skip(long n) throws IOException
skip
in class FilterInputStream
IOException
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in class FilterInputStream
IOException
Copyright 1999-2012 The Apache Software Foundation. All Rights Reserved.