Package com.thebuzzmedia.exiftool
Interface ExecutionStrategy
- All Superinterfaces:
AutoCloseable
- All Known Implementing Classes:
DefaultStrategy
,PoolStrategy
,StayOpenStrategy
ExifTool execution strategy.
For instance:
Implementation should also define a close method: this method will be used to stop remaining process and clean previous execution. Calling
For instance:
- Execution using a one-shot process.
-
Execution using
stay_open
flag: this strategy means that a process is started and re-used for next executions.
execute(com.thebuzzmedia.exiftool.process.CommandExecutor, java.lang.String, java.util.List<java.lang.String>, com.thebuzzmedia.exiftool.process.OutputHandler)
method.
Implementation should also define a close method: this method will be used to stop remaining process and clean previous execution. Calling
close()
method should not prevent instances to be used
for a next execution.-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
This method should be used to: Close remaining process (if any). Clean previous executions. For instance, with thestay_open
flag, this method should: Close opened process. Stop task used to automatically close process. Once closed, ExifTool should still be able to use this strategy if a call toexecute(com.thebuzzmedia.exiftool.process.CommandExecutor, java.lang.String, java.util.List<java.lang.String>, com.thebuzzmedia.exiftool.process.OutputHandler)
is made.void
execute
(CommandExecutor executor, String exifTool, List<String> arguments, OutputHandler handler) Execute exiftool command.boolean
Check if exiftool process is currently running.boolean
isSupported
(Version version) Check if this strategy should is supported with this specific version.void
shutdown()
Shutdown the strategy.
-
Method Details
-
execute
void execute(CommandExecutor executor, String exifTool, List<String> arguments, OutputHandler handler) throws IOException Execute exiftool command.- Parameters:
executor
- ExifTool withExecutor.exifTool
- ExifTool withPath.arguments
- Command line arguments.handler
- Handler to read command output.- Throws:
IOException
- If an error occurred during execution.
-
isRunning
boolean isRunning()Check if exiftool process is currently running. This method is important especially ifstay_open
flag has been enabled.- Returns:
true
ifexiftool
process is currently open,false
otherwise.
-
isSupported
Check if this strategy should is supported with this specific version.- Parameters:
version
- ExifTool Version.- Returns:
true
if this strategy may be used safely with this specific version,false
otherwise.
-
close
This method should be used to:- Close remaining process (if any).
- Clean previous executions.
stay_open
flag, this method should:- Close opened process.
- Stop task used to automatically close process.
execute(com.thebuzzmedia.exiftool.process.CommandExecutor, java.lang.String, java.util.List<java.lang.String>, com.thebuzzmedia.exiftool.process.OutputHandler)
is made.- Specified by:
close
in interfaceAutoCloseable
- Throws:
Exception
- If an error occurred while stopping exiftool client.
-
shutdown
Shutdown the strategy.- Throws:
Exception
- If an error occurred while stopping exiftool client.
-