public class LimitedByteInput extends ByteInputStream
byteInput
Constructor and Description |
---|
LimitedByteInput(ByteInput byteInput,
long limit)
Create a new instance.
|
Modifier and Type | Method and Description |
---|---|
int |
read()
Reads the next byte of data from the input stream.
|
int |
read(byte[] b,
int off,
int len)
Read some bytes from the input stream into the given array.
|
long |
skip(long n)
Skips over and discards up to
n bytes of data from this input stream. |
available, close, read
mark, markSupported, reset
public LimitedByteInput(ByteInput byteInput, long limit)
byteInput
- the byte input to read fromlimit
- the maximum number of bytes to readpublic int read() throws IOException
read
in interface ByteInput
read
in class ByteInputStream
IOException
- if an error occurspublic int read(byte[] b, int off, int len) throws IOException
read
in interface ByteInput
read
in class ByteInputStream
b
- the destination arrayoff
- the offset into the array into which data should be readlen
- the number of bytes to attempt to fill in the destination arrayIOException
- if an error occurspublic long skip(long n) throws IOException
n
bytes of data from this input stream. If the end of stream is reached,
this method returns 0
in order to be consistent with InputStream.skip(long)
.skip
in interface ByteInput
skip
in class ByteInputStream
n
- the number of bytes to attempt to skipIOException
- if an error occursCopyright © 2021 JBoss by Red Hat. All rights reserved.