public class StreamPump extends Object implements Runnable
in
to
the specified OutputStream out
.
It can be called in a blocking (default) or non-blocking fashion, and can optionally automatically close the output stream when it is done (default). Transfer block size is also configurable.
Example Usage
InputStream myInput = new InputStream();
Modifier and Type | Field and Description |
---|---|
private boolean |
autoShutOff
A configurable field that flags the closing of the outputStream when done.
|
private int |
blockSize
The block size of the chunk to dump.
|
private Exception |
exception
A class holder for any exceptions that are thrown.
|
private InputStream |
in
A class copy of the InputStream to get data from.
|
private OutputStream |
out
The class copy of the OutputStream to pipe in's data to.
|
Constructor and Description |
---|
StreamPump()
Constructor for the StreamPump object
|
StreamPump(InputStream input,
OutputStream output)
Constructor for the StreamPump object
|
StreamPump(InputStream input,
OutputStream output,
boolean shutoff)
Constructor for the StreamPump object
|
Modifier and Type | Method and Description |
---|---|
int |
getBlockSize()
Gets the BlockSize attribute of the StreamPump object
|
Exception |
getException()
Gets the Exception attribute of the StreamPump object
|
InputStream |
getInputStream()
Gets the InputStream attribute of the StreamPump object
|
OutputStream |
getOutputStream()
Gets the OutputStream attribute of the StreamPump object
|
void |
run()
Main processing method for the StreamPump object.
|
void |
setBlockSize(int i)
Sets the BlockSize attribute of the StreamPump object
|
void |
setInputStream(InputStream i)
Sets the InputStream attribute of the StreamPump object
|
void |
setOutputStream(OutputStream o)
Sets the OutputStream attribute of the StreamPump object
|
Thread |
start()
Starts pumping the data through the Pipe.
|
private InputStream in
private OutputStream out
private boolean autoShutOff
private int blockSize
public StreamPump()
public StreamPump(InputStream input, OutputStream output)
input
- Description of Parameteroutput
- Description of Parameterpublic StreamPump(InputStream input, OutputStream output, boolean shutoff)
input
- Description of Parameteroutput
- Description of Parametershutoff
- Description of Parameterpublic void setInputStream(InputStream i)
i
- The new Input valuepublic void setOutputStream(OutputStream o)
o
- The new Output valuepublic void setBlockSize(int i)
i
- The new BlockSize valuepublic InputStream getInputStream()
public OutputStream getOutputStream()
public int getBlockSize()
public Exception getException()
public Thread start()
WebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses