public final class ConstrainableInputStream extends BufferedInputStream
Modifier and Type | Field and Description |
---|---|
private boolean |
capped |
private static int |
DefaultSize |
private boolean |
interrupted |
private int |
maxSize |
private int |
remaining |
private long |
startTime |
private long |
timeout |
in
Modifier | Constructor and Description |
---|---|
private |
ConstrainableInputStream(InputStream in,
int bufferSize,
int maxSize) |
Modifier and Type | Method and Description |
---|---|
private boolean |
expired() |
int |
read(byte[] b,
int off,
int len) |
ByteBuffer |
readToByteBuffer(int max)
Reads this inputstream to a ByteBuffer.
|
void |
reset() |
ConstrainableInputStream |
timeout(long startTimeNanos,
long timeoutMillis) |
static ConstrainableInputStream |
wrap(InputStream in,
int bufferSize,
int maxSize)
If this InputStream is not already a ConstrainableInputStream, let it be one.
|
available, close, mark, markSupported, read, skip
read
private static final int DefaultSize
private final boolean capped
private final int maxSize
private long startTime
private long timeout
private int remaining
private boolean interrupted
private ConstrainableInputStream(InputStream in, int bufferSize, int maxSize)
public static ConstrainableInputStream wrap(InputStream in, int bufferSize, int maxSize)
in
- the input stream to (maybe) wrapbufferSize
- the buffer size to use when readingmaxSize
- the maximum size to allow to be read. 0 == infinite.public int read(byte[] b, int off, int len) throws IOException
read
in class BufferedInputStream
IOException
public ByteBuffer readToByteBuffer(int max) throws IOException
IOException
public void reset() throws IOException
reset
in class BufferedInputStream
IOException
public ConstrainableInputStream timeout(long startTimeNanos, long timeoutMillis)
private boolean expired()
WebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses