Package gov.nasa.pds.label.io
Class LengthLimitedInputStream
java.lang.Object
java.io.InputStream
java.io.FilterInputStream
gov.nasa.pds.label.io.LengthLimitedInputStream
- All Implemented Interfaces:
Closeable,AutoCloseable
public class LengthLimitedInputStream extends FilterInputStream
Implements a stream that wraps another input stream, but limits
the portion read.
-
Field Summary
Fields inherited from class java.io.FilterInputStream
in -
Constructor Summary
Constructors Constructor Description LengthLimitedInputStream(InputStream in, long offset, long size)Creates a new instance wrapping the given input stream. -
Method Summary
Methods inherited from class java.io.FilterInputStream
close, mark, markSupported, read, resetMethods inherited from class java.io.InputStream
nullInputStream, readAllBytes, readNBytes, readNBytes, skipNBytes, transferTo
-
Constructor Details
-
LengthLimitedInputStream
Creates a new instance wrapping the given input stream.- Parameters:
in- the underlying input streamoffset- the offset from the start of the stream to begin readingsize- the size of the portion of the data to read- Throws:
IOException- if there is an error accessing the underlying input stream
-
-
Method Details
-
available
- Overrides:
availablein classFilterInputStream- Throws:
IOException
-
read
- Overrides:
readin classFilterInputStream- Throws:
IOException
-
read
- Overrides:
readin classFilterInputStream- Throws:
IOException
-
skip
- Overrides:
skipin classFilterInputStream- Throws:
IOException
-