public final class PipeUtil
extends java.lang.Object
Pipe interface.| Modifier and Type | Class and Description |
|---|---|
static interface |
PipeUtil.Drainer
Drains 'something' by reading data from an input stream.
|
static interface |
PipeUtil.Filler
Fills 'something' by writing data to an output stream.
|
static interface |
PipeUtil.FillerAndDrainer |
static interface |
PipeUtil.InputOutputStreams
A tuple of one
InputStream and one OutputStream. |
| Modifier and Type | Method and Description |
|---|---|
static PipeUtil.InputOutputStreams |
asInputOutputStreams(Pipe pipe)
Creates and returns a pair of output stream and input stream which write to and read from the given
pipe. |
static Pipe |
deleteFileOnClose(Pipe delegate,
java.io.File file) |
static Pipe |
onClose(Pipe delegate,
RunnableWhichThrows<java.io.IOException> runnable) |
static void |
temporaryStorage(PipeUtil.FillerAndDrainer fillerAndDrainer)
Convenience method for
temporaryStorage(Filler, Drainer) when the filler wants to pass information to
the drainer. |
static void |
temporaryStorage(PipeUtil.Filler filler,
PipeUtil.Drainer drainer)
Creates a temporary
PipeFactory.elasticPipe(), invokes the filler (which fills the pipe), then
invokes the drainer (which drains the pipe), and eventually closes the pipe. |
public static PipeUtil.InputOutputStreams asInputOutputStreams(Pipe pipe)
pipe. The streams block the calling thread while the pipe is full resp. empty.
Closing the output stream indicates an end-of-input condition to the input stream.
Closing the input stream closes the pipe, and the next write attempt to the output stream will cause an
EOFException.
public static Pipe deleteFileOnClose(Pipe delegate, java.io.File file)
delegate, and, in addition, deletes the
given file on Pipe.close()public static Pipe onClose(Pipe delegate, RunnableWhichThrows<java.io.IOException> runnable)
delegate, and, in addition, runs the given
runnable on Pipe.close() AFTER having closed the delegatepublic static void temporaryStorage(PipeUtil.FillerAndDrainer fillerAndDrainer) throws java.io.IOException
temporaryStorage(Filler, Drainer) when the filler wants to pass information to
the drainer.java.io.IOExceptionpublic static void temporaryStorage(PipeUtil.Filler filler, PipeUtil.Drainer drainer) throws java.io.IOException
PipeFactory.elasticPipe(), invokes the filler (which fills the pipe), then
invokes the drainer (which drains the pipe), and eventually closes the pipe.java.io.IOException