Package org.im4java.process
Class Pipe
java.lang.Object
org.im4java.process.Pipe
- All Implemented Interfaces:
ErrorConsumer
,InputProvider
,OutputConsumer
This class implements a pipe. Useful for piping input to a process
or piping output/error from a process to other streams.
You can use the same Pipe-object for both ends of a process-pipeline. But you cannot use the same Pipe-object as an OutputConsumer and ErrorConsumer at the same time.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
consumeError
(InputStream pInputStream) The ErrorConsumer must read the error of a process from the given InputStream.void
consumeOutput
(InputStream pInputStream) The OutputConsumer must read the output of a process from the given InputStream.void
provideInput
(OutputStream pOutputStream) The InputProvider must write the input to the given OutputStream.
-
Field Details
-
BUFFER_SIZE
public static final int BUFFER_SIZEDefault buffer size of the pipe. Currently 64KB.- See Also:
-
-
Constructor Details
-
Pipe
Constructor. At least one of the arguments should not be null.
-
-
Method Details
-
provideInput
The InputProvider must write the input to the given OutputStream.- Specified by:
provideInput
in interfaceInputProvider
- Throws:
IOException
-
consumeOutput
The OutputConsumer must read the output of a process from the given InputStream.- Specified by:
consumeOutput
in interfaceOutputConsumer
- Throws:
IOException
-
consumeError
The ErrorConsumer must read the error of a process from the given InputStream.- Specified by:
consumeError
in interfaceErrorConsumer
- Throws:
IOException
-