|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.InputStream
java.io.FilterInputStream
com.bbn.openmap.io.InputStreamSplitter
public class InputStreamSplitter
The InputStreamSplitter
is a
FilterInputStream
that reads and returns data from
an input stream, while also sending the data to an output stream.
Thus, the InputStreamSplitter
can provide a handy
sniffing/logging mechanism. In addition, the output stream could be
coupled with a PipedInputStream
to create two input
sources out of a single source.
Field Summary | |
---|---|
protected java.io.OutputStream |
out
The OutputStream to route the data to. |
Fields inherited from class java.io.FilterInputStream |
---|
in |
Constructor Summary | |
---|---|
InputStreamSplitter(java.io.InputStream in,
java.io.OutputStream out)
Creates an InputStreamSplitter . |
Method Summary | |
---|---|
void |
close()
Closes the input and output streams and releases any system resources associated with those streams. |
void |
flush()
Flushes the output stream. |
int |
read()
Reads the next byte of data from the input stream and writes it to the output stream. |
int |
read(byte[] b)
Reads up to b.length bytes of data from this
input stream into an array of bytes, and writes those bytes to
the output stream. |
int |
read(byte[] b,
int off,
int len)
Reads up to len bytes of data from this input
stream into an array of bytes, and writes those bytes to the
output stream. |
Methods inherited from class java.io.FilterInputStream |
---|
available, mark, markSupported, reset, skip |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.io.OutputStream out
Constructor Detail |
---|
public InputStreamSplitter(java.io.InputStream in, java.io.OutputStream out)
InputStreamSplitter
.
in
- the underlying input streamout
- the output streamMethod Detail |
---|
public int read() throws java.io.IOException
int
in the range 0
to
255
. If no byte is available because the end of
the stream has been reached, the value -1
is
returned. This method blocks until input data is available, the
end of the stream is detected, or an exception is thrown.
read
in class java.io.FilterInputStream
-1
if the end
of the stream is reached.
java.io.IOException
- if an I/O error occurs.public int read(byte[] b) throws java.io.IOException
b.length
bytes of data from this
input stream into an array of bytes, and writes those bytes to
the output stream. This method blocks until some input is
available.
read
in class java.io.FilterInputStream
b
- the buffer into which the data is read.
-1
if there is no more data because the
end of the stream has been reached.
java.io.IOException
- if an I/O error occurs.read(byte[], int, int)
public int read(byte[] b, int off, int len) throws java.io.IOException
len
bytes of data from this input
stream into an array of bytes, and writes those bytes to the
output stream. This method blocks until some input is
available.
read
in class java.io.FilterInputStream
b
- the buffer into which the data is read.off
- the start offset of the data.len
- the maximum number of bytes read.
-1
if there is no more data because the
end of the stream has been reached.
java.io.IOException
- if an I/O error occurs.public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in class java.io.FilterInputStream
java.io.IOException
- if an I/O error occurs.public void flush() throws java.io.IOException
java.io.IOException
- if an I/O error occurs.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |