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 PipeUtil.InputOutputStreams |
asInputOutputStreams(Pipe pipe,
boolean blocking)
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,
File file) |
static Pipe |
onClose(Pipe delegate,
RunnableWhichThrows<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.
This method is equivalent with
asInputOutputStream(pipe, true);
public static PipeUtil.InputOutputStreams asInputOutputStreams(Pipe pipe, boolean blocking)
pipe
.
While the pipe is full: If blocking== true
then the output stream blocks until space is
available. Otherwise, if blocking== false
, the output stream throws a BlockingException
.
While the pipe is empty: If blocking== true
then the input stream blocks until data is
available, otherwise, if blocking== false
, the input stream throws a BlockingException
.
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, File file)
closed
public static Pipe onClose(Pipe delegate, RunnableWhichThrows<IOException> runnable)
Pipe.close()
AFTER having closed the delegatepublic static void temporaryStorage(PipeUtil.FillerAndDrainer fillerAndDrainer) throws IOException
temporaryStorage(Filler, Drainer)
when the filler wants to pass information to
the drainer.IOException
public static void temporaryStorage(PipeUtil.Filler filler, PipeUtil.Drainer drainer) throws IOException
PipeFactory.elasticPipe()
, invokes the filler (which fills the pipe),
then invokes the drainer (which drains the pipe), and eventually closes the pipe.IOException
Copyright © 2018 Arno Unkrig. All rights reserved.