Class DefaultCommandProcess
java.lang.Object
com.thebuzzmedia.exiftool.process.executor.DefaultCommandProcess
- All Implemented Interfaces:
CommandProcess,AutoCloseable
Default implementation for
This implementation used instance of
Note: This implementation is not thread safe.
CommandProcess interface.
This implementation used instance of
InputStream to handle
read operation and instance of OutputStream to handle write
operation. These streams may come from instance of Process for instance.
Note: This implementation is not thread safe.
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultCommandProcess(InputStream is, OutputStream os, InputStream err) Create process. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()voidflush()Flush pending write operations.booleanisClosed()Check if current process has been closed.booleanCheck if current process is still opened.read()Read output until a null line is read.read(OutputHandler handler) Read output until: A null line is read. Handler returns false when line is read. Since command process will not be closed, a simple string is returned (an exit status cannot be computed).voidWrite set of inputs to the current process.voidWrite input string to the current process.
-
Constructor Details
-
DefaultCommandProcess
Create process.- Parameters:
is- Input stream.os- Output stream.err- Error stream.
-
-
Method Details
-
read
Description copied from interface:CommandProcessRead output until a null line is read.
Since command process will not be closed, a simple string is returned (an exit status cannot be computed).- Specified by:
readin interfaceCommandProcess- Returns:
- Command result.
- Throws:
IOException- If an error occurred during operation.
-
read
Description copied from interface:CommandProcessRead output until:- A null line is read.
- Handler returns false when line is read.
- Specified by:
readin interfaceCommandProcess- Parameters:
handler- Output handler.- Returns:
- Full output.
- Throws:
IOException- If an error occurred during operation.
-
write
Description copied from interface:CommandProcessWrite input string to the current process.- Specified by:
writein interfaceCommandProcess- Parameters:
input- Input.others- Other inputs.- Throws:
IOException- If an error occurred during operation.
-
write
Description copied from interface:CommandProcessWrite set of inputs to the current process.- Specified by:
writein interfaceCommandProcess- Parameters:
inputs- Collection of inputs.- Throws:
IOException- If an error occurred during operation.
-
flush
Description copied from interface:CommandProcessFlush pending write operations.- Specified by:
flushin interfaceCommandProcess- Throws:
IOException- If an error occurred during operation.
-
isRunning
public boolean isRunning()Description copied from interface:CommandProcessCheck if current process is still opened. If this method returnstrue, thenCommandProcess.isClosed()should returnfalse.- Specified by:
isRunningin interfaceCommandProcess- Returns:
trueif process is open,falseotherwise.
-
isClosed
public boolean isClosed()Description copied from interface:CommandProcessCheck if current process has been closed. If this method returnstrue, thenCommandProcess.isRunning()should returnfalse.- Specified by:
isClosedin interfaceCommandProcess- Returns:
trueif process is closed,falseotherwise.
-
close
- Specified by:
closein interfaceAutoCloseable- Throws:
Exception
-