|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.camel.component.exec.ExecResultConverter
@Converter public final class ExecResultConverter
Default converters for ExecResult
. For details how to extend the
converters check out the Camel docs for type
converters.
Method Summary | ||
---|---|---|
static
|
convertTo(Class<T> type,
Exchange exchange,
ExecResult result)
Converts ExecResult to the type T . |
|
static byte[] |
convertToByteArray(ExecResult result,
Exchange exchange)
|
|
static Document |
convertToDocument(ExecResult result,
Exchange exchange)
|
|
static InputStream |
convertToInputStream(ExecResult result)
|
|
static String |
convertToString(ExecResult result,
Exchange exchange)
|
|
static InputStream |
toInputStream(ExecResult execResult)
Returns InputStream object with the output of the
executable. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
@Converter public static InputStream convertToInputStream(ExecResult result) throws FileNotFoundException
FileNotFoundException
@Converter public static byte[] convertToByteArray(ExecResult result, Exchange exchange) throws FileNotFoundException, IOException
FileNotFoundException
IOException
@Converter public static String convertToString(ExecResult result, Exchange exchange) throws FileNotFoundException
FileNotFoundException
@Converter public static Document convertToDocument(ExecResult result, Exchange exchange) throws FileNotFoundException
FileNotFoundException
public static <T> T convertTo(Class<T> type, Exchange exchange, ExecResult result) throws FileNotFoundException
ExecResult
to the type T
.
T
- The type to convert totype
- Class instance of the type to which to convertexchange
- a Camel exchange. If exchange is null
, no
conversion will be maderesult
- the exec result
ExecResult
FileNotFoundException
- if there is a file in the execResult, and
the file can not be foundpublic static InputStream toInputStream(ExecResult execResult) throws FileNotFoundException
InputStream
object with the output of the
executable. If there is ExecCommand.getOutFile()
, its content is
preferred to ExecResult.getStdout()
. If no out file is set, and
the stdout of the exec result is null
returns the stderr of
the exec result. ByteArrayInputStream
, its
reset()
method is called.
execResult
- ExecResult object to convert to InputStream.
null
if both ExecResult.getStdout()
and ExecResult.getStderr()
are null
, or if
the execResult
is null
.
FileNotFoundException
- if the ExecCommand.getOutFile()
can
not be opened. In this case the out file must have had a not
null
value
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |