Constructor and Description |
---|
StreamPumper(InputStream in,
OutputStream out)
Create a new stream pumper.
|
StreamPumper(InputStream in,
OutputStream out,
boolean closeWhenExhausted)
Create a new stream pumper.
|
Modifier and Type | Method and Description |
---|---|
int |
getBufferSize()
Get the size in bytes of the read buffer.
|
Exception |
getException()
Get the exception encountered, if any.
|
boolean |
isFinished()
Tells whether the end of the stream has been reached.
|
void |
run()
Copies data from the input stream to the output stream.
|
void |
setAutoFlush(boolean autoFlush)
Set whether data should be flushed through to the output stream.
|
void |
setBufferSize(int bufferSize)
Set the size in bytes of the read buffer.
|
void |
stop()
Stop the pumper as soon as possible.
|
void |
waitFor()
This method blocks until the stream pumper finishes.
|
public StreamPumper(InputStream in, OutputStream out, boolean closeWhenExhausted)
in
- Input stream to read data fromout
- Output stream to write data to.closeWhenExhausted
- If true, the output stream will be closed when the input is exhausted.public StreamPumper(InputStream in, OutputStream out)
in
- Input stream to read data fromout
- Output stream to write data to.public void setAutoFlush(boolean autoFlush)
autoFlush
- If true, push through data; if false, let it be bufferedpublic void run()
public boolean isFinished()
public void waitFor() throws InterruptedException
InterruptedException
isFinished()
public void setBufferSize(int bufferSize)
bufferSize
- the buffer size to use.IllegalStateException
- if the StreamPumper is already running.public int getBufferSize()
public Exception getException()
public void stop()
Copyright © 2008-2013 Sonatype. All Rights Reserved.