|
com.Ostermiller.util Java Utilities |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.InputStream
com.Ostermiller.util.SizeLimitInputStream
public class SizeLimitInputStream
An input stream wrapper that will read only a set number of bytes from the underlying stream.
Constructor Summary | |
---|---|
SizeLimitInputStream(InputStream in,
long maxBytesToRead)
Create a new size limit input stream from another stream given a size limit. |
Method Summary | |
---|---|
boolean |
allBytesRead()
Tell whether the number of bytes specified in the constructor have been read yet. |
int |
available()
|
void |
close()
Close this stream and underlying streams. |
long |
getBytesLeft()
Get the maximum number of bytes left to read before the limit (set in the constructor) is reached. |
long |
getBytesRead()
Get the number of bytes actually read from this stream. |
long |
getMaxBytesToRead()
Get the number of total bytes (including bytes already read) that can be read from this stream (as set in the constructor). |
void |
mark(int readlimit)
|
boolean |
markSupported()
|
int |
read()
|
int |
read(byte[] b)
|
int |
read(byte[] b,
int off,
int len)
|
void |
reset()
|
long |
skip(long n)
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SizeLimitInputStream(InputStream in, long maxBytesToRead)
in
- The input stream.maxBytesToRead
- the max number of bytes to allow to be read from the underlying stream.Method Detail |
---|
public long getBytesRead()
public long getBytesLeft()
public boolean allBytesRead()
public long getMaxBytesToRead()
public int read() throws IOException
read
in class InputStream
IOException
public int read(byte[] b) throws IOException
read
in class InputStream
IOException
public int read(byte[] b, int off, int len) throws IOException
read
in class InputStream
IOException
public long skip(long n) throws IOException
skip
in class InputStream
IOException
public int available() throws IOException
available
in class InputStream
IOException
public void close() throws IOException
Consider wrapping this stream in a NoCloseStream so that clients can call close() with no effect.
close
in interface Closeable
close
in class InputStream
IOException
public void mark(int readlimit)
mark
in class InputStream
public void reset() throws IOException
reset
in class InputStream
IOException
public boolean markSupported()
markSupported
in class InputStream
|
com.Ostermiller.util Java Utilities |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright © 2001-2012 by Stephen Ostermiller