com.gc.iotools.stream.is
public class SizeLimitInputStream extends InputStream
BoundedInputStream.| Modifier and Type | Field and Description |
|---|---|
protected long |
currentPosition
Deprecated.
The number of bytes that have been read from the
in stream. |
protected InputStream |
in
Deprecated.
The underlying stream from which data are read.
|
protected long |
markPosition
Deprecated.
The position in the stream when mark(int) was called.
|
protected long |
maxSize
Deprecated.
The number of bytes to read at most from the
in stream. |
| Constructor and Description |
|---|
SizeLimitInputStream(InputStream in,
long maxSize)
Deprecated.
Create a new
SizeLimitInputStream from another stream
given a size limit. |
| Modifier and Type | Method and Description |
|---|---|
int |
available()
Deprecated.
|
void |
close()
Deprecated.
Close the underlying stream.
|
long |
getBytesLeft()
Deprecated.
Get the maximum number of bytes left to read before the limit, set in
the constructor, is reached.
|
long |
getBytesRead()
Deprecated.
Get the number of bytes actually read from this stream.
|
long |
getMaxSize()
Deprecated.
Get the number of total bytes (including bytes already read) that can
be read from this stream (as set in the constructor).
|
void |
mark(int readlimit)
Deprecated.
|
boolean |
markSupported()
Deprecated.
|
int |
read()
Deprecated.
|
int |
read(byte[] b)
Deprecated.
|
int |
read(byte[] b,
int off,
int len)
Deprecated.
|
void |
reset()
Deprecated.
|
long |
skip(long n)
Deprecated.
|
protected long currentPosition
protected InputStream in
protected long markPosition
protected final long maxSize
in stream. Read
methods should check to ensure that the number of bytes read never
exceeds maxSize.public SizeLimitInputStream(InputStream in, long maxSize)
Create a new SizeLimitInputStream from another stream
given a size limit.
Bytes are read from the underlying stream until size limit is reached.
in - The underlying input stream from where the data is read.maxSize - the max number of bytes to allow to be read from the
underlying stream.public int available()
throws IOException
available in class InputStreamIOExceptionpublic void close()
throws IOException
Close the underlying stream. Calling this method may make data on the underlying stream unavailable.
close in interface Closeableclose in class InputStreamIOExceptionpublic long getBytesLeft()
public long getBytesRead()
public long getMaxSize()
public void mark(int readlimit)
mark in class InputStreampublic boolean markSupported()
markSupported in class InputStreampublic int read()
throws IOException
read in class InputStreamIOExceptionpublic int read(byte[] b)
throws IOException
read in class InputStreamIOExceptionpublic int read(byte[] b,
int off,
int len)
throws IOException
read in class InputStreamIOExceptionpublic void reset()
throws IOException
reset in class InputStreamIOExceptionpublic long skip(long n)
throws IOException
skip in class InputStreamIOExceptionCopyright © 2008–2015. All rights reserved.