- java.lang.Object
-
- org.refcodes.runtime.ProcessResult
-
- All Implemented Interfaces:
org.refcodes.mixin.ResultAccessor<String,RuntimeException>
public class ProcessResult extends Object implements org.refcodes.mixin.ResultAccessor<String,RuntimeException>
Retrieves the Result of the given process asString
.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.refcodes.mixin.ResultAccessor
org.refcodes.mixin.ResultAccessor.ResultBuilder<RES extends Object,B extends org.refcodes.mixin.ResultAccessor.ResultBuilder<RES,B>>, org.refcodes.mixin.ResultAccessor.ResultMutator<RES extends Object>, org.refcodes.mixin.ResultAccessor.ResultProperty<RES extends Object,EXC extends Exception>
-
-
Constructor Summary
Constructors Constructor Description ProcessResult(Process aProcess)
Constructs aProcessResult
instance which will synchronously return the process' result viagetResult()
(andtoString()
accordingly).ProcessResult(Process aProcess, int aTimeoutMillis)
Constructs aProcessResult
instance which will synchronously return the process' result viagetResult()
(andtoString()
accordingly).
-
-
-
Constructor Detail
-
ProcessResult
public ProcessResult(Process aProcess) throws IOException
Constructs aProcessResult
instance which will synchronously return the process' result viagetResult()
(andtoString()
accordingly).- Parameters:
aProcess
- TheProcess
from which to retrieve the result.- Throws:
IOException
- Thrown in case there were problems retrieving the result. If possible, the error stream of the process is captured in the exception's message.
-
ProcessResult
public ProcessResult(Process aProcess, int aTimeoutMillis) throws InterruptedException, IOException
Constructs aProcessResult
instance which will synchronously return the process' result viagetResult()
(andtoString()
accordingly).- Parameters:
aProcess
- TheProcess
from which to retrieve the result.aTimeoutMillis
- The time to wait till to terminate with anInterruptedException
.- Throws:
IOException
- Thrown in case there were problems retrieving the result. If possible, the error stream of the process is capturedInterruptedException
- Thrown in case the timeout has exceeded before process' termination.
-
-
Method Detail
-
getResult
public String getResult()
- Specified by:
getResult
in interfaceorg.refcodes.mixin.ResultAccessor<String,RuntimeException>
-
hasResult
public boolean hasResult()
- Specified by:
hasResult
in interfaceorg.refcodes.mixin.ResultAccessor<String,RuntimeException>
-
-