|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.io.InputStream
java.io.FilterInputStream
org.terrier.utility.FixedSizeInputStream
public class FixedSizeInputStream
An inputstream which only reads a fixed length of a parent input stream. No buffering is done.
| Field Summary | |
|---|---|
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 |
| Fields inherited from class java.io.FilterInputStream |
|---|
in |
| Constructor Summary | |
|---|---|
FixedSizeInputStream(java.io.InputStream in,
long _maxsize)
create a new FixedSizeInputStream, using in as the underlying InputStream, and maxsize as the maximum number of bytes to read. |
|
| Method Summary | |
|---|---|
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 |
| Methods inherited from class java.io.FilterInputStream |
|---|
available, read |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected final long maxsize
protected long size
protected boolean suppressClose
| Constructor Detail |
|---|
public FixedSizeInputStream(java.io.InputStream in,
long _maxsize)
in - underlying InputStream to read bytes from._maxsize - maximum number of bytes to read.| Method Detail |
|---|
public int read()
throws java.io.IOException
read in class java.io.FilterInputStreamjava.io.IOException - If an I/O error occurs.
public int read(byte[] cbuf,
int off,
int len)
throws java.io.IOException
read in class java.io.FilterInputStreamcbuf - Destination bufferoff - Offset at which to start storing byteslen - Maximum number of bytes to read
java.io.IOException - If an I/O error occurs in the underlying reader.
public long skip(long n)
throws java.io.IOException
skip in class java.io.FilterInputStreamn - long the number of characters to skip.
java.io.IOException - if there is any error while
reading from the stream.public boolean markSupported()
markSupported in class java.io.FilterInputStreampublic void mark(int readAheadLimit)
mark in class java.io.FilterInputStream
public void reset()
throws java.io.IOException
reset in class java.io.FilterInputStreamjava.io.IOExceptionpublic void suppressClose()
public void close()
throws java.io.IOException
close in interface java.io.Closeableclose in class java.io.FilterInputStreamjava.io.IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||