public class LimitInputStream extends java.io.FilterInputStream implements Limit
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
limitInPlace |
protected int |
remainingBytes |
| Constructor and Description |
|---|
LimitInputStream(java.io.InputStream in)
Construct a LimitInputStream and call the clearLimit() method.
|
| Modifier and Type | Method and Description |
|---|---|
int |
available() |
int |
clearLimit()
Clear any limit set by setLimit.
|
boolean |
markSupported()
This stream doesn't support mark/reset, independent of whether the
underlying stream does so or not.
|
int |
read() |
int |
read(byte[] b,
int off,
int len) |
void |
setInput(java.io.InputStream in) |
void |
setLimit(int length)
Set the limit of the stream that can be read.
|
long |
skip(long count) |
protected int remainingBytes
protected boolean limitInPlace
public LimitInputStream(java.io.InputStream in)
public int read()
throws java.io.IOException
read in class java.io.FilterInputStreamjava.io.IOExceptionpublic int read(byte[] b,
int off,
int len)
throws java.io.IOException
read in class java.io.FilterInputStreamjava.io.IOExceptionpublic long skip(long count)
throws java.io.IOException
skip in class java.io.FilterInputStreamjava.io.IOExceptionpublic int available()
throws java.io.IOException
available in class java.io.FilterInputStreamjava.io.IOExceptionpublic void setLimit(int length)
public int clearLimit()
clearLimit in interface Limitpublic void setInput(java.io.InputStream in)
public boolean markSupported()
The reason for not supporting mark/reset, is that it is hard to combine with the limit functionality without always keeping track of the number of bytes read.
markSupported in class java.io.FilterInputStreamfalseApache Derby V10.10 Internals - Copyright © 2004,2014 The Apache Software Foundation. All Rights Reserved.