@InterfaceAudience.Private public class BoundedDelegatingInputStream extends DelegatingInputStream
Modifier and Type | Field and Description |
---|---|
protected long |
limit |
protected long |
pos |
in
Constructor and Description |
---|
BoundedDelegatingInputStream(InputStream in,
long limit) |
Modifier and Type | Method and Description |
---|---|
int |
available() |
int |
read()
Call the delegate's
read() method if the current position is less than the limit. |
int |
read(byte[] b,
int off,
int len)
Call the delegate's
read(byte[], int, int) method if the current position is less than
the limit. |
void |
setDelegate(InputStream in,
long limit) |
long |
skip(long len)
Call the delegate's
skip(long) method. |
getDelegate, setDelegate
close, mark, markSupported, read, reset
public BoundedDelegatingInputStream(InputStream in, long limit)
public void setDelegate(InputStream in, long limit)
public int read() throws IOException
read()
method if the current position is less than the limit.read
in class FilterInputStream
IOException
public int read(byte[] b, int off, int len) throws IOException
read(byte[], int, int)
method if the current position is less than
the limit.read
in class FilterInputStream
b
- read bufferoff
- Start offsetlen
- The number of bytes to readIOException
public long skip(long len) throws IOException
skip(long)
method.skip
in class FilterInputStream
len
- the number of bytes to skipIOException
public int available() throws IOException
available
in class FilterInputStream
IOException
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.