public class SubInputStream
extends java.io.FilterInputStream
This InputStream can be used to read chunks from a larger file of which the length is known in advance.
Constructor and Description |
---|
SubInputStream(java.io.InputStream in,
long maxLen)
Creates a new SubInputStream.
|
SubInputStream(java.io.InputStream in,
long maxLen,
boolean closeUnderlying)
Creates a new SubInputStream.
|
public SubInputStream(java.io.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(java.io.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 java.io.IOException
read
in class java.io.FilterInputStream
java.io.IOException
public int read(byte[] b, int off, int len) throws java.io.IOException
read
in class java.io.FilterInputStream
java.io.IOException
public long skip(long n) throws java.io.IOException
skip
in class java.io.FilterInputStream
java.io.IOException
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in class java.io.FilterInputStream
java.io.IOException
Copyright 1999-2012 The Apache Software Foundation. All Rights Reserved.