|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.InputStream
java.io.FilterInputStream
de.vxart.io.LimitedInputStream
public class LimitedInputStream
Allows to only read a limited number of bytes from the underlying stream and then signals EOF.
Constructor Summary | |
---|---|
LimitedInputStream(java.io.InputStream in,
long limit)
Wraps the given InputStream and will only read as many bytes from it as the limit allows; it will then signal EOF by returning -1 from the read methods. |
Method Summary | |
---|---|
int |
available()
|
void |
close()
"Closes" the InputStream by skipping all remaining bytes. |
long |
getBytesRead()
Returns the number of bytes already read from this stream. |
long |
getBytesRemaining()
Returns the number of bytes remaining before the limit of this stream. |
int |
read()
|
int |
read(byte[] b)
|
int |
read(byte[] b,
int off,
int len)
|
long |
skip(long n)
|
long |
skipAll()
Skips all bytes left in this stream before the limit is reached. |
Methods inherited from class java.io.FilterInputStream |
---|
mark, markSupported, reset |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public LimitedInputStream(java.io.InputStream in, long limit)
in
- the stream to limit read access tolimit
- the number of bytes allowed to be readMethod Detail |
---|
public long getBytesRead()
public long getBytesRemaining()
public int available() throws java.io.IOException
available
in class java.io.FilterInputStream
java.io.IOException
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 int read(byte[] b) 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 long skipAll() throws java.io.IOException
java.io.IOException
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in class java.io.FilterInputStream
java.io.IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |