Package eu.simuline.util
Class Finder.ExecFilter
- java.lang.Object
-
- eu.simuline.util.Finder.Filter
-
- eu.simuline.util.Finder.ExecFilter
-
- Enclosing class:
- Finder
static class Finder.ExecFilter extends Finder.Filter
Filter executing a shell command and passes the file received if the shell command succeeds according to its return code.- See Also:
Finder.exec(String[]),Finder.ExecJavaFilter
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.String[]cmdThe command to be executed including arguments separated by space as to be passed toRuntime.exec(String)in order to decide whether the given file passes the filter.
-
Constructor Summary
Constructors Constructor Description ExecFilter(java.lang.String[] cmd)Creates an execution filter from the given command and arguments.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanpass(java.io.File file)The given file passes this filter, i.e. this method returnstrueif the shell command given bycmdsucceeds according to its return value (which is then zero).-
Methods inherited from class eu.simuline.util.Finder.Filter
and, not, or
-
-
-
-
Field Detail
-
cmd
private final java.lang.String[] cmd
The command to be executed including arguments separated by space as to be passed toRuntime.exec(String)in order to decide whether the given file passes the filter. For more information on the entries seeFinder.exec(String[]).
-
-
Constructor Detail
-
ExecFilter
ExecFilter(java.lang.String[] cmd)
Creates an execution filter from the given command and arguments.- Parameters:
cmd- The 0th entry is the command itself and the others are arguments. For details seeFinder.exec(String[]).
-
-
Method Detail
-
pass
public boolean pass(java.io.File file)
The given file passes this filter, i.e. this method returnstrueif the shell command given bycmdsucceeds according to its return value (which is then zero).Execution proceeds in the following steps:
-
Replace the arguments
Finder.EXEC_ARGby the long name offile. - Create a separate process to execute the command.
- Wait for execution end and
- pass if the return value 0 indicates success.
- Specified by:
passin classFinder.Filter
-
Replace the arguments
-
-