public class ExiftoolSupport
extends java.lang.Object
EXIF_TOOL_PATH
, using this class to
communicate with ExifTool is as simple as creating an instance (
ExifToolSupport tool = new ExifToolSupport()
) and then making
calls to getImageMeta(File)
, a map with key / value pairs will be
returned.
Modifier and Type | Class and Description |
---|---|
static class |
ExiftoolSupport.Format
Enum used to define the 2 different output formats that
Tag values
can be returned in: numeric or human-readable text. |
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
EXIF_TOOL_PATH
The absolute path to the ExifTool executable on the host system running
this class as defined by the "
exiftool.path " system property. |
protected java.util.logging.Logger |
log |
protected static java.util.regex.Pattern |
TAG_VALUE_PATTERN
Compiled
Pattern of ": " used to split compact output from
ExifTool evenly into name/value pairs. |
Constructor and Description |
---|
ExiftoolSupport(java.util.logging.Logger logger)
Constructor
|
Modifier and Type | Method and Description |
---|---|
java.util.Map<java.lang.String,java.lang.String> |
getImageMeta(java.io.File filename) |
java.util.Map<java.lang.String,java.lang.String> |
getImageMeta(java.io.File filename,
ExiftoolSupport.Format exiftoolOutputFormat) |
protected com.highqsoft.moma.rules.mapping.ExiftoolSupport.IOStream |
startExifToolProcess(java.util.List<java.lang.String> args) |
public static final java.lang.String EXIF_TOOL_PATH
exiftool.path
" system property.
If ExifTool is on your system path and running the command "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 path, then this property will need to be set to point at it
before using this class.
This system property can be set on startup with:
-Dexiftool.path=/path/to/exiftool
or by calling System.setProperty(String, String)
before
this class is loaded.
On Windows be sure to double-escape the path to the tool, for example:
-Dexiftool.path=C:\\Tools\\exiftool.exe
Default value is "exiftool
".
new File(".").getAbsolutePath()
points at
during runtime.protected static final java.util.regex.Pattern TAG_VALUE_PATTERN
Pattern
of ": " used to split compact output from
ExifTool evenly into name/value pairs.protected java.util.logging.Logger log
public ExiftoolSupport(java.util.logging.Logger logger)
logger,
- instance of the Logger classprotected com.highqsoft.moma.rules.mapping.ExiftoolSupport.IOStream startExifToolProcess(java.util.List<java.lang.String> args) throws java.lang.RuntimeException
java.lang.RuntimeException
public java.util.Map<java.lang.String,java.lang.String> getImageMeta(java.io.File filename) throws java.lang.IllegalArgumentException, java.lang.SecurityException, java.io.IOException
filename
- of the file, which attributes should be readjava.lang.IllegalArgumentException
java.lang.SecurityException
java.io.IOException
public java.util.Map<java.lang.String,java.lang.String> getImageMeta(java.io.File filename, ExiftoolSupport.Format exiftoolOutputFormat) throws java.lang.IllegalArgumentException, java.lang.SecurityException, java.io.IOException
filename
- of the file, which attributes should be readexiftoolOutputFormat
- the format, which sould exiftool user for output.
valid: Format.NUMERIC or Format.HUMAN_READABLEjava.lang.IllegalArgumentException
java.lang.SecurityException
java.io.IOException