|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.InputStream
java.io.FilterInputStream
net.sf.zig_project.gpl.common.io.TelescopicInputStream
An InputStream that not only encapsulates another InputStream, but is encapsulated by an InputStream. When such a stream encounters a subsection that requires an additional filter, it can be inserted as an "expansion" into the correct location within the stream. Likewise, when a filter has completed operation, the stream can "collapse" removing the pass through filtration.
For example consider a hypothetical network stream.
Socket input stream -> decompresser -> application inputDuring a bulk read, an encryption enable feature is discovered. First, the remainder the bulk read is put back into the input stream, as
Socket input stream -> decompresser -> byte[] reservoir -> application inputthen the stream is expanded with a decipher stream
Socket input stream -> decompresser -> byte[] reservoir -> decipher -> application inputas input is read from the stream, eventually the reservoir is depleted, and the memory can be reclaimed.
Socket input stream -> decompresser ->Leaving the present stream as:byte[] reservoir ->decipher -> application input
Socket input stream -> decompresser -> decipher -> application input
The default implementation of this class will automatically collapse.
Subclasses are encouraged to override the read(byte[], int, int)
and read()
methods, calling their super
counterparts
to indicate that filtration has completed and the filter may be safely
collapsed.
Field Summary |
Fields inherited from class java.io.FilterInputStream |
in |
Constructor Summary | |
TelescopicInputStream(InputStream is)
Creates a new TelescopicInputStream using is as the underlayer. |
Method Summary | |
protected void |
complete()
Called when the current filter has completed all possible filtration. |
int |
read()
Reads one byte from the input. |
int |
read(byte[] buf,
int off,
int len)
Bulk read from input. |
Methods inherited from class java.io.FilterInputStream |
available, close, mark, markSupported, read, reset, skip |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public TelescopicInputStream(InputStream is)
Method Detail |
protected void complete()
public int read() throws IOException
IOException
public int read(byte[] buf, int off, int len) throws IOException
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |