| Modifier and Type | Field and Description |
|---|---|
| protected boolean | |
| protected int |
| Access | Constructor and Description |
|---|---|
| public | LimitInputStream(InputStream
InputStream to wrap in)Construct a LimitInputStream and call the clearLimit() method. |
| Modifier and Type | Method and Description |
|---|---|
| public int | available()
Overrides java. Returns an estimate of the number of bytes that can be read (or skipped over) from this input stream without blocking by the next caller of a method for this input stream. |
| public int | Returns: the number of bytes within the limit that have not been read. -1 if no limit was set.Implements org. Clear any limit set by setLimit. |
| public boolean | Returns: falseOverrides java. This stream doesn't support mark/reset, independent of whether the underlying stream does so or not. |
| public int | |
| public int | read(byte[]
the buffer into which the data is read. b, int the start offset in array off, int b
at which the data is written.the maximum number of bytes to read. len)Overrides java. Reads up to |
| public void | |
| public void | setLimit(int
The length to set length)Implements org. Set the limit of the stream that can be read. |
| public long | skip(long
the number of bytes to be skipped. count)Overrides java. Skips over and discards |
| limitInPlace | back to summary |
|---|---|
| protected boolean limitInPlace | |
| remainingBytes | back to summary |
|---|---|
| protected int remainingBytes | |
| LimitInputStream | back to summary |
|---|---|
| public LimitInputStream(InputStream in) Construct a LimitInputStream and call the clearLimit() method.
| |
| available | back to summary |
|---|---|
| public int available() throws IOException Overrides java. Doc from java. Returns an estimate of the number of bytes that can be read (or skipped over) from this input stream without blocking by the next caller of a method for this input stream. The next caller might be the same thread or another thread. A single read or skip of this many bytes will not block, but may read or skip fewer bytes.
| |
| clearLimit | back to summary |
|---|---|
| public int clearLimit() Implements org. Clear any limit set by setLimit. After this call no limit checking will be made on any read until a setLimit()) call is made.
| |
| markSupported | back to summary |
|---|---|
| public boolean markSupported() Overrides java. This stream doesn't support mark/reset, independent of whether the underlying stream does so or not. 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.
| |
| read | back to summary |
|---|---|
| public int read() throws IOException Overrides java. Doc from java. Reads the next byte of data from the input stream. The value byte is
returned as an
| |
| read | back to summary |
|---|---|
| public int read(byte[] b, int off, int len) throws IOException Overrides java. Doc from java. Reads up to
| |
| setInput | back to summary |
|---|---|
| public void setInput(InputStream in) | |
| setLimit | back to summary |
|---|---|
| public void setLimit(int length) Implements org. Set the limit of the stream that can be read. After this call up to and including length bytes can be read from or skipped in the stream. Any attempt to read more than length bytes will result in an EOFException
| |
| skip | back to summary |
|---|---|
| public long skip(long count) throws IOException Overrides java. Doc from java. Skips over and discards
| |