| 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.
|
Throwable |
getException()
Get the exception encountered, if any.
|
InputStream |
getIn() |
InputStream |
getInputStream() |
OutputStream |
getOut() |
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 |
setNonBlocking(boolean nonBlocking)
Set whether data should be read in a non blocking way.
|
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 InputStream getIn()
public OutputStream getOut()
public void setAutoflush(boolean autoflush)
autoflush - If true, push through data; if false, let it be bufferedpublic void setNonBlocking(boolean nonBlocking)
nonBlocking - If true, data will be read in a non blocking modepublic void run()
public boolean isFinished()
public void waitFor()
throws InterruptedException
InterruptedExceptionisFinished()public void setBufferSize(int bufferSize)
bufferSize - the buffer size to use.IllegalStateException - if the StreamPumper is already running.public int getBufferSize()
public Throwable getException()
public void stop()
public InputStream getInputStream()
Copyright © 2007–2014 The Apache Software Foundation. All rights reserved.