| 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()
Tell whether the end of the stream has been reached.
|
void |
run()
Copy 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 - The input stream to read data from.out - The 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 - The input stream to read data from.out - The 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 buffered.public void setNonBlocking(boolean nonBlocking)
nonBlocking - If true, data will be read in a non blocking mode.public void run()
public boolean isFinished()
public void waitFor()
throws InterruptedException
InterruptedException - if the stream pumper has been interrupted.isFinished()public void setBufferSize(int bufferSize)
bufferSize - the buffer size to use.public int getBufferSize()
public Throwable getException()
public void stop()
public InputStream getInputStream()
Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.