public class MeteredInputStream
extends java.io.FilterInputStream
Constructor and Description |
---|
MeteredInputStream(java.io.InputStream in,
int size) |
Modifier and Type | Method and Description |
---|---|
int |
available()
Returns the number of bytes that can be read
without blocking.
|
void |
close()
Does NOT close the input stream.
|
void |
mark(int readlimit)
Marks the current position in the input stream.
|
boolean |
markSupported()
Returns true if this stream type supports mark/reset.
|
int |
read()
Reads a byte.
|
int |
read(byte[] b)
Reads into an array of bytes.
|
int |
read(byte[] b,
int off,
int len)
Reads into an array of bytes.
|
void |
reset()
Repositions the stream to the last marked position.
|
long |
skip(long n)
Skips bytes of input.
|
public final int read() throws java.io.IOException
read
in class java.io.FilterInputStream
java.io.IOException
- If an I/O error has occurred.public final int read(byte[] b) throws java.io.IOException
read
in class java.io.FilterInputStream
b
- the buffer into which the data is readjava.io.IOException
- If an I/O error has occurred.public final int read(byte[] b, int off, int len) throws java.io.IOException
read
in class java.io.FilterInputStream
b
- the buffer into which the data is readoff
- the start offset of the datalen
- the maximum number of bytes readjava.io.IOException
- If an I/O error has occurred.public final long skip(long n) throws java.io.IOException
skip
in class java.io.FilterInputStream
n
- bytes to be skippedjava.io.IOException
- If an I/O error has occurred.public final int available() throws java.io.IOException
available
in class java.io.FilterInputStream
java.io.IOException
public final 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
- If an I/O error has occurred.public final void mark(int readlimit)
mark
in class java.io.FilterInputStream
readlimit
- the maximum limit of bytes allowed tobe read before the
mark position becomes invalid.public final void reset() throws java.io.IOException
reset
in class java.io.FilterInputStream
java.io.IOException
public final boolean markSupported()
markSupported
in class java.io.FilterInputStream