public class FixedSizeInputStream extends FilterInputStream
| Modifier and Type | Field and Description |
|---|---|
protected long |
maxsize
maximum bytes to read
|
protected long |
size
number of bytes read so far
|
protected boolean |
suppressClose
prevent a close() from doing anyhing, like closing the underlying stream
|
in| Constructor and Description |
|---|
FixedSizeInputStream(InputStream in,
long _maxsize)
create a new FixedSizeInputStream, using in as the underlying
InputStream, and maxsize as the maximum number of bytes to read.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
void |
mark(int readAheadLimit) |
boolean |
markSupported() |
int |
read()
Read a single byte from the underlying Reader.
|
int |
read(byte[] cbuf,
int off,
int len)
Read bytes into a portion of an array.
|
void |
reset() |
long |
skip(long n)
Skips n bytes from the stream.
|
void |
suppressClose()
Sets it so that close() will never be called
|
available, readprotected final long maxsize
protected long size
protected boolean suppressClose
public FixedSizeInputStream(InputStream in, long _maxsize)
in - underlying InputStream to read bytes from._maxsize - maximum number of bytes to read.public int read()
throws IOException
read in class FilterInputStreamIOException - If an I/O error occurs.public int read(byte[] cbuf,
int off,
int len)
throws IOException
read in class FilterInputStreamcbuf - Destination bufferoff - Offset at which to start storing byteslen - Maximum number of bytes to readIOException - If an I/O error occurs in the underlying reader.public long skip(long n)
throws IOException
skip in class FilterInputStreamn - long the number of characters to skip.IOException - if there is any error while
reading from the stream.public boolean markSupported()
markSupported in class FilterInputStreampublic void mark(int readAheadLimit)
mark in class FilterInputStreampublic void reset()
throws IOException
reset in class FilterInputStreamIOExceptionpublic void suppressClose()
public void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in class FilterInputStreamIOExceptionTerrier Information Retrieval Platform4.1. Copyright © 2004-2015, University of Glasgow