public class InputStreamSplitter
extends java.io.InputStream
OutputStream.write(int)
or
OutputStream.write(byte[], int, int)
methods.Modifier and Type | Field and Description |
---|---|
private boolean |
copySkipped
If the
skip(long) method should copy
to the output streams or no. |
private java.io.OutputStream[] |
copyTo
Streams to copy the data to.
|
private java.io.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 and Description |
---|
InputStreamSplitter(java.io.InputStream in,
boolean copySkipped,
boolean readToEnd,
java.io.OutputStream... copyTo)
Create a new input stream splitter.
|
InputStreamSplitter(java.io.InputStream in,
java.io.OutputStream... copyTo)
Create a new input stream splitter.
|
Modifier and Type | Method and Description |
---|---|
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) |
private int numRead
private final java.io.InputStream in
private final java.io.OutputStream[] copyTo
private final boolean copySkipped
skip(long)
method should copy
to the output streams or no.private final boolean readToEnd
public InputStreamSplitter(java.io.InputStream in, java.io.OutputStream... copyTo)
in
- The input stream to read fromcopyTo
- The output streams to copy data topublic InputStreamSplitter(java.io.InputStream in, boolean copySkipped, boolean readToEnd, java.io.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 allowedpublic int available() throws java.io.IOException
available
in class java.io.InputStream
java.io.IOException
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in class java.io.InputStream
java.io.IOException
public void mark(int readlimit)
mark
in class java.io.InputStream
public boolean markSupported()
markSupported
in class java.io.InputStream
public int read() throws java.io.IOException
read
in class java.io.InputStream
java.io.IOException
public int read(byte[] b, int off, int len) throws java.io.IOException
read
in class java.io.InputStream
java.io.IOException
public int read(byte[] b) throws java.io.IOException
read
in class java.io.InputStream
java.io.IOException
public void reset() throws java.io.IOException
reset
in class java.io.InputStream
java.io.IOException
public long skip(long n) throws java.io.IOException
skip
in class java.io.InputStream
java.io.IOException
public long getNumRead()
private void copy(int b) throws java.io.IOException
java.io.IOException
private void copy(byte[] b, int off, int len) throws java.io.IOException
java.io.IOException