| Modifier and Type | Class and Description |
|---|---|
| pack-priv class | StreamPumper.PostStopHandle
A handle that can be used after |
| Modifier and Type | Field and Description |
|---|---|
| private volatile boolean | |
| private boolean | |
| private int | |
| private final boolean | |
| private Exception | |
| private volatile boolean | |
| private final InputStream | |
| private final OutputStream | |
| private static final long | |
| private StreamPumper. | |
| private static final int | |
| private boolean | |
| private final boolean |
| Access | Constructor and Description |
|---|---|
| public | StreamPumper(InputStream
input stream to read data from is, OutputStream output stream to write data to. os, boolean if true, the output stream will be closed when
the input is exhausted. closeWhenExhausted)Create a new StreamPumper. |
| public | StreamPumper(InputStream
input stream to read data from is, OutputStream output stream to write data to. os, boolean if true, the output stream will be closed when
the input is exhausted. closeWhenExhausted, boolean whether the pumper should use useAvailable)available to determine
whether input is ready, thus trying to emulate
non-blocking behavior.Create a new StreamPumper. |
| public | StreamPumper(InputStream
input stream to read data from is, OutputStream output stream to write data to. os)Create a new StreamPumper. |
| Modifier and Type | Method and Description |
|---|---|
| private void | |
| public synchronized int | |
| public synchronized Exception | |
| public boolean | Returns: true is the stream has been exhausted.Tells whether the end of the stream has been reached. |
| public void | |
| pack-priv void | setAutoflush(boolean
if true, push through data; if false, let it be buffered autoflush)Set whether data should be flushed through to the output stream. |
| public synchronized void | |
| pack-priv synchronized StreamPumper. | Returns: Returns aPostStopHandle for the callers to
know if the status of post-stop activities, that happen, before this
StreamPumper is actually finishedStop the pumper as soon as possible. |
| public synchronized void | |
| private void |
| askedToStop | back to summary |
|---|---|
| private volatile boolean askedToStop | |
| autoflush | back to summary |
|---|---|
| private boolean autoflush | |
| bufferSize | back to summary |
|---|---|
| private int bufferSize | |
| closeWhenExhausted | back to summary |
|---|---|
| private final boolean closeWhenExhausted | |
| exception | back to summary |
|---|---|
| private Exception exception | |
| finished | back to summary |
|---|---|
| private volatile boolean finished | |
| is | back to summary |
|---|---|
| private final InputStream is | |
| os | back to summary |
|---|---|
| private final OutputStream os | |
| POLL_INTERVAL | back to summary |
|---|---|
| private static final long POLL_INTERVAL | |
| postStopHandle | back to summary |
|---|---|
| private StreamPumper. | |
| SMALL_BUFFER_SIZE | back to summary |
|---|---|
| private static final int SMALL_BUFFER_SIZE | |
| started | back to summary |
|---|---|
| private boolean started | |
| useAvailable | back to summary |
|---|---|
| private final boolean useAvailable | |
| StreamPumper | back to summary |
|---|---|
| public StreamPumper(InputStream is, OutputStream os, boolean closeWhenExhausted) Create a new StreamPumper.
| |
| StreamPumper | back to summary |
|---|---|
| public StreamPumper(InputStream is, OutputStream os, boolean closeWhenExhausted, boolean useAvailable) Create a new StreamPumper. Note If you set useAvailable to true, you must
explicitly invoke
| |
| StreamPumper | back to summary |
|---|---|
| public StreamPumper(InputStream is, OutputStream os) Create a new StreamPumper.
| |
| doPostStop | back to summary |
|---|---|
| private void doPostStop() throws IOException | |
| getBufferSize | back to summary |
|---|---|
| public synchronized int getBufferSize() Get the size in bytes of the read buffer.
| |
| getException | back to summary |
|---|---|
| public synchronized Exception getException() Get the exception encountered, if any.
| |
| isFinished | back to summary |
|---|---|
| public boolean isFinished() Tells whether the end of the stream has been reached.
| |
| run | back to summary |
|---|---|
| public void run() Implements java. Copies data from the input stream to the output stream. Terminates as soon as the input stream is closed or an error occurs.
| |
| setAutoflush | back to summary |
|---|---|
| pack-priv void setAutoflush(boolean autoflush) Set whether data should be flushed through to the output stream.
| |
| setBufferSize | back to summary |
|---|---|
| public synchronized void setBufferSize(int bufferSize) Set the size in bytes of the read buffer.
| |
| stop | back to summary |
|---|---|
| pack-priv synchronized StreamPumper. Stop the pumper as soon as possible. Note that it may continue to block on the input stream but it will really stop the thread as soon as it gets EOF or any byte, and it will be marked as finished.
| |
| waitFor | back to summary |
|---|---|
| public synchronized void waitFor() throws InterruptedException This method blocks until the StreamPumper finishes.
| |
| waitForInput | back to summary |
|---|---|
| private void waitForInput(InputStream is) throws IOException, InterruptedException | |
stop() has been invoked to check if the
StreamPumper is in the process of do some post-stop tasks (like flushing
of streams), before finishing.
| Modifier and Type | Field and Description |
|---|---|
| private boolean | |
| private final CountDownLatch |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv boolean | Returns: Returns true if the post-stop activities completed within the specifiedtimeout.
Else returns falseThe maximum amount of time to wait for the post-stop activities to complete timeout, final TimeUnit The unit of timeUnit)timeoutWaits for a maximum of |
| pack-priv boolean | isInPostStopTasks()
Returns true if the |
| inPostStopTasks | back to summary |
|---|---|
| private boolean inPostStopTasks | |
| latch | back to summary |
|---|---|
| private final CountDownLatch latch | |
| PostStopHandle | back to summary |
|---|---|
| pack-priv PostStopHandle() | |
| awaitPostStopCompletion | back to summary |
|---|---|
| pack-priv boolean awaitPostStopCompletion(final long timeout, final TimeUnit timeUnit) throws InterruptedException Waits for a maximum of
| |
| isInPostStopTasks | back to summary |
|---|---|
| pack-priv boolean isInPostStopTasks() Returns true if the | |