public class LimitedInputStream extends FilterInputStream
InputStream that only supplies a limit number of
bytes from the underlying input stream.in| Constructor and Description |
|---|
LimitedInputStream(InputStream inputStream,
long length)
Creates a new LimitedInputStream that supplies at most
length bytes from the given input stream. |
| Modifier and Type | Method and Description |
|---|---|
int |
available() |
void |
consume()
Consumes the input stream, i.e. read all bytes until the limit is
reached.
|
void |
mark(int readlimit)
|
boolean |
markSupported() |
int |
read() |
int |
read(byte[] b,
int off,
int len) |
void |
reset()
|
long |
skip(long n) |
close, readpublic LimitedInputStream(InputStream inputStream, long length)
length bytes from the given input stream.inputStream - The input streamlength - The number of bytes to readpublic int available()
throws IOException
available in class FilterInputStreamIOExceptionFilterInputStream.available()public int read()
throws IOException
read in class FilterInputStreamIOExceptionFilterInputStream.read()public int read(byte[] b,
int off,
int len)
throws IOException
read in class FilterInputStreamIOExceptionFilterInputStream.read(byte[], int, int)public long skip(long n)
throws IOException
skip in class FilterInputStreamIOExceptionFilterInputStream.skip(long)public void mark(int readlimit)
mark in class FilterInputStreamFilterInputStream.mark(int)public boolean markSupported()
markSupported in class FilterInputStreamfalseFilterInputStream.markSupported()public void reset()
throws IOException
reset in class FilterInputStreamIOExceptionFilterInputStream.reset()public void consume()
throws IOException
IOException - if an I/O error occursCopyright © 2026. All rights reserved.