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
public class LengthLimitedInputStream
- extends FilterInputStream
Implements a stream that wraps another input stream, but limits
the portion read.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
LengthLimitedInputStream
public LengthLimitedInputStream(InputStream in,
long offset,
long size)
throws IOException
- 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
available
public int available()
throws IOException
- Overrides:
available
in class FilterInputStream
- Throws:
IOException
read
public int read()
throws IOException
- Overrides:
read
in class FilterInputStream
- Throws:
IOException
read
public int read(byte[] b,
int off,
int len)
throws IOException
- Overrides:
read
in class FilterInputStream
- Throws:
IOException
skip
public long skip(long n)
throws IOException
- Overrides:
skip
in class FilterInputStream
- Throws:
IOException
Copyright © 2013. All Rights Reserved.