|
2.17.2: 2011-06-17 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.io.InputStream net.sf.basedb.util.InputStreamSplitter
public class InputStreamSplitter
This class can be used to split an input stream into one or more
additional output streams. When data is read from this input stream
the bytes are also written to the specified output streams with one of the
OutputStream.write(int)
or
OutputStream.write(byte[], int, int)
methods.
Field Summary | |
---|---|
private boolean |
copySkipped
If the skip(long) method should copy
to the output streams or no. |
private OutputStream[] |
copyTo
Streams to copy the data to. |
private InputStream |
in
The source input stream to read from. |
private int |
numRead
|
private boolean |
readToEnd
If the remainder of the input stream should be copied if it is closed before the end. |
Constructor Summary | |
---|---|
InputStreamSplitter(InputStream in,
boolean copySkipped,
boolean readToEnd,
OutputStream... copyTo)
Create a new input stream splitter. |
|
InputStreamSplitter(InputStream in,
OutputStream... copyTo)
Create a new input stream splitter. |
Method Summary | |
---|---|
int |
available()
|
void |
close()
|
private void |
copy(byte[] b,
int off,
int len)
Write data to all output streams. |
private void |
copy(int b)
Write data to all output streams. |
long |
getNumRead()
Get the number of bytes that has been read or skipped from the input stream. |
void |
mark(int readlimit)
|
boolean |
markSupported()
|
int |
read()
|
int |
read(byte[] b)
|
int |
read(byte[] b,
int off,
int len)
|
void |
reset()
|
long |
skip(long n)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private int numRead
private final InputStream in
private final OutputStream[] copyTo
private final boolean copySkipped
skip(long)
method should copy
to the output streams or no.
private final boolean readToEnd
Constructor Detail |
---|
public InputStreamSplitter(InputStream in, OutputStream... copyTo)
in
- The input stream to read fromcopyTo
- The output streams to copy data topublic InputStreamSplitter(InputStream in, boolean copySkipped, boolean readToEnd, OutputStream... copyTo)
in
- The input stream to read from. Null is not allowedcopySkipped
- TRUE if skipped bytes should be copied, FALSE otherwisereadToEnd
- If the remainder of the input stream should be copied
if it is closed before the endcopyTo
- The output streams to copy data to. Null is not allowedMethod Detail |
---|
public int available() throws IOException
available
in class InputStream
IOException
public void close() throws IOException
close
in interface Closeable
close
in class InputStream
IOException
public void mark(int readlimit)
mark
in class InputStream
public boolean markSupported()
markSupported
in class InputStream
public int read() throws IOException
read
in class InputStream
IOException
public int read(byte[] b, int off, int len) throws IOException
read
in class InputStream
IOException
public int read(byte[] b) throws IOException
read
in class InputStream
IOException
public void reset() throws IOException
reset
in class InputStream
IOException
public long skip(long n) throws IOException
skip
in class InputStream
IOException
public long getNumRead()
private void copy(int b) throws IOException
IOException
private void copy(byte[] b, int off, int len) throws IOException
IOException
|
2.17.2: 2011-06-17 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |