ikrs.io
Class ReadLimitInputStream
java.lang.Object
java.io.InputStream
ikrs.io.BytePositionInputStream
ikrs.io.ReadLimitInputStream
- All Implemented Interfaces:
- java.io.Closeable
public class ReadLimitInputStream
- extends BytePositionInputStream
This input stream is an extension of the BytePositionInputStream.
It stores a read limit (long) which, when reached, causes EOI.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
ReadLimitInputStream
public ReadLimitInputStream(java.io.InputStream in,
long readLimit)
throws java.lang.NullPointerException,
java.lang.IllegalArgumentException
- Throws:
java.lang.NullPointerException
java.lang.IllegalArgumentException
getMaxAvailable
protected long getMaxAvailable()
available
public int available()
throws java.io.IOException
- Overrides:
available
in class BytePositionInputStream
- Throws:
java.io.IOException
close
public void close()
throws java.io.IOException
- Specified by:
close
in interface java.io.Closeable
- Overrides:
close
in class BytePositionInputStream
- Throws:
java.io.IOException
mark
public void mark(int readlimit)
- The mark-method is a bit tricky! This implementation does NOT support marks and
throws an IOException if called.
- Overrides:
mark
in class BytePositionInputStream
markSupported
public boolean markSupported()
- Overrides:
markSupported
in class BytePositionInputStream
read
public int read()
throws java.io.IOException
- Overrides:
read
in class BytePositionInputStream
- Throws:
java.io.IOException
read
public int read(byte[] b)
throws java.io.IOException
- Overrides:
read
in class BytePositionInputStream
- Throws:
java.io.IOException
read
public int read(byte[] b,
int off,
int len)
throws java.io.IOException
- Overrides:
read
in class BytePositionInputStream
- Throws:
java.io.IOException
reset
public void reset()
throws java.io.IOException
- Overrides:
reset
in class BytePositionInputStream
- Throws:
java.io.IOException
skip
public long skip(long n)
throws java.io.IOException
- Overrides:
skip
in class BytePositionInputStream
- Throws:
java.io.IOException
toString
public java.lang.String toString()
- Overrides:
toString
in class BytePositionInputStream