Class ExternalContentTransformation
java.lang.Object
org.eclipse.epsilon.picto.transformers.ExternalContentTransformation
Utility class for using external programs in transforming content.
- Since:
- 2.2
- Author:
- Sina Madani
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedExternalContentTransformation(String program, Object... arguments) ExternalContentTransformation(Path outputFile, String program, Object... arguments) -
Method Summary
Modifier and TypeMethodDescriptionbyte[]call()static PathcreateTempFile(String extension, byte... contents) Convenience method for temporary files used in intermediate transformations.String[]getArgs()byte[]intstatic StringresolveNodeProgram(String program) final voidrun()protected voidvoidsetLogFile(Path logFile) voidsetOutputFile(Path outputFile) voidsetTimeout(Duration timeout)
-
Field Details
-
program
-
args
-
timeout
-
logFile
-
outputFile
-
resultCode
protected int resultCode -
hasRun
protected boolean hasRun -
result
protected byte[] result -
processOutput
-
-
Constructor Details
-
ExternalContentTransformation
-
ExternalContentTransformation
-
-
Method Details
-
createTempFile
Convenience method for temporary files used in intermediate transformations.- Parameters:
extension- The file extension.contents- The initial contents of the file. May be null.- Returns:
- The absolute path of the temporary file.
- Throws:
IOException- If the temp file couldn't be created.
-
resolveNodeProgram
- Parameters:
program- The Node.js program name.- Returns:
- The absolute path of the command needed to invoke the program.
-
getResultCode
public int getResultCode() -
screenRun
- Throws:
IllegalStateException
-
getResult
- Throws:
IOException
-
run
public final void run() -
call
- Specified by:
callin interfaceCallable<byte[]>- Throws:
IOException
-
getException
-
getLogFile
-
setLogFile
-
getOutputFile
-
setOutputFile
-
getTimeout
-
setTimeout
-
getProgram
-
getArgs
-
getProcessOutput
- Returns:
- The stdout of the invoked program.
- Throws:
IllegalStateException- If the program hasn't been run yet.
-