public class ExifToolBuilder extends Object
ExifTool
instance.
This builder should be used to create instance of ExifTool
.
-Dexiftool.withPath=/withPath/to/exiftool
or by
calling System.setProperty(String, String)
before
this class is loaded.
exiftool
. In this case, exiftool
command must be globally available.
exiftool
successfully executes it, leaving this value unchanged will work fine on
any platform. If the ExifTool executable is named something else or not
in the system withPath, then this property will need to be set to point at it
before using this class.
On Windows be sure to double-escape the withPath to the tool,
for example: -Dexiftool.withPath=C:\\Tools\\exiftool.exe
.
Default value is exiftool
.
Relative withPath values (e.g. bin/tools/exiftool
) are executed with
relation to the base directory the VM process was started in. Essentially
the directory that new File(".").getAbsolutePath()
points at
during runtime.
CommandExecutor
interface.
stay_open
flag is enabled, then an
instance of UnsupportedFeatureException
may be thrown during ExifTool creation.
If this exception occurs, then you should probably:
final ExifTool exifTool;
try {
exifTool = new ExifToolBuilder()
.enableStayOpen()
.build();
}
catch (UnsupportedFeatureException ex) {
exifTool = new ExifToolBuilder().build();
}
withStrategy(com.thebuzzmedia.exiftool.ExecutionStrategy)
method.
Usage:
ExifTool exifTool = new ExifToolBuilder()
.withStrategy(new MyCustomStrategy())
.build();
Constructor and Description |
---|
ExifToolBuilder() |
Modifier and Type | Method and Description |
---|---|
ExifTool |
build()
Create exiftool instance with previous settings.
|
ExifToolBuilder |
enableStayOpen()
Enable
stay_open feature. |
ExifToolBuilder |
enableStayOpen(long cleanupDelay)
Enable
stay_open feature. |
ExifToolBuilder |
enableStayOpen(Scheduler scheduler)
Enable
stay_open feature and perform cleanup task using given scheduler . |
ExifToolBuilder |
withExecutor(CommandExecutor executor)
Override default exifTool executor.
|
ExifToolBuilder |
withPath(File path)
Override default path.
|
ExifToolBuilder |
withPath(String path)
Override default path.
|
ExifToolBuilder |
withStrategy(ExecutionStrategy strategy)
Override default execution strategy.
|
public ExifToolBuilder withPath(String path)
exiftool.path
or is
set with exiftool
otherwise. Setting the path explicitly will disable automatic
lookup.path
- New path.public ExifToolBuilder withPath(File path)
exiftool.path
or is
set with exiftool
otherwise. Setting the path explicitly will disable automatic
lookup.
Note: If path is not an executable file, a warning
will be logged but it will not fail.path
- New path.public ExifToolBuilder withExecutor(CommandExecutor executor)
executor
- New withExecutor.public ExifToolBuilder enableStayOpen()
stay_open
feature.public ExifToolBuilder enableStayOpen(long cleanupDelay)
stay_open
feature.
Note:
cleanupDelay
- Interval (in milliseconds) between automatic clean operation.public ExifToolBuilder enableStayOpen(Scheduler scheduler)
stay_open
feature and perform cleanup task using given scheduler
.
Note:
withStrategy(com.thebuzzmedia.exiftool.ExecutionStrategy)
has already been called, then calling is useless.enableStayOpen(long)
has already been called, then given delay
will be
ignored and the specified scheduler will be used.
scheduler
- Scheduler used to process automatic cleanup task..public ExifToolBuilder withStrategy(ExecutionStrategy strategy)
enableStayOpen()
has been called, then strategy associated with stay_open
flag
will be ignored.strategy
- Strategy.public ExifTool build()
Copyright © 2015. All Rights Reserved.