|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.io.InputStream | +--java.io.FilterInputStream | +--com.sun.jimi.util.FullyBufferedInputStream
This class implements a buffered input stream which sits on top of any existing InputStream. This class buffers all data read through the underlying stream and therefore provides a markable input stream for any underlying stream. At initialisation a mark() is made at the start of the input stream to enable return to start of stream using reset(); [eventually] The currently used portion of the buffer can be dropped if required via dropBuf(). This class could be extended to keep the buffered input data stream in a local file cache in the future. This would involved checking for write capabilities and the definition [probably in environment] for where to write the files too. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Field Summary | |
protected java.util.Vector |
buffers
maintains the sequential set of allocated memory buffers which in total hold all the buffered data. |
protected int |
bufSize
size of each allocated buffer stored in buffers |
protected static int |
BUFSIZE
default size of chunks of input stream to store and read in at a time. |
protected int |
count
index of next location in buffer that is free to use |
protected java.io.InputStream |
in
The underlying input stream. |
protected int |
markpos
Marked location in input stream. |
protected int |
pos
index of next character to deliver |
Fields inherited from class java.io.FilterInputStream |
in |
Constructor Summary | |
FullyBufferedInputStream(java.io.InputStream in)
Constructor |
|
FullyBufferedInputStream(java.io.InputStream in,
int bufSize)
Allows control of the bufSize for buffering |
Method Summary | |
int |
available()
|
void |
close()
|
void |
dropBuf()
Release all buffered data and memory. |
void |
mark(int readlimit)
Mark a location in the input stream, note that the readlimit is totally ingored. |
boolean |
markSupported()
Marks are always supported by this input stream. |
int |
read()
|
int |
read(byte[] b,
int off,
int len)
|
void |
reset()
Reset position to the mark. |
long |
skip(long n)
|
Methods inherited from class java.io.FilterInputStream |
read |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
protected java.io.InputStream in
protected java.util.Vector buffers
protected int count
protected int pos
protected int bufSize
protected int markpos
protected static final int BUFSIZE
Constructor Detail |
public FullyBufferedInputStream(java.io.InputStream in)
public FullyBufferedInputStream(java.io.InputStream in, int bufSize)
Method Detail |
public void dropBuf()
public int read() throws java.io.IOException
public int read(byte[] b, int off, int len) throws java.io.IOException
public long skip(long n) throws java.io.IOException
public void close() throws java.io.IOException
public int available() throws java.io.IOException
public void mark(int readlimit)
public void reset() throws java.io.IOException
public boolean markSupported()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |