Package it.tidalwave.image.metadata
Class Directory
- java.lang.Object
-
- it.tidalwave.image.metadata.JavaBeanSupport
-
- it.tidalwave.image.metadata.Directory
-
- All Implemented Interfaces:
java.io.Serializable
- Direct Known Subclasses:
it.tidalwave.image.metadata.EXIFDirectoryGenerated
,it.tidalwave.image.metadata.IPTCDirectoryGenerated
,MakerNote
,XMP
public class Directory extends JavaBeanSupport implements java.io.Serializable
This class provides basic support for all kinds of metadata such EXIF, IPTC or maker notes.- Author:
- Fabrizio Giudici
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Directory.TagInfo
-
Field Summary
Fields Modifier and Type Field Description protected static java.util.Map<java.lang.String,Directory.TagInfo>
mapTagInfo
-
Fields inherited from class it.tidalwave.image.metadata.JavaBeanSupport
propertyChangeSupport, vetoableChangeSupport
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
containsTag(int tag)
boolean
equals(java.lang.Object object)
protected static java.lang.String
formatDateTime(java.time.Instant date)
java.time.Instant
getLatestModificationTime()
<T> java.util.Optional<T>
getObject(int tag, java.lang.Class<T> asType)
Returns a tag value converted to the specified type.java.lang.Object
getRawObject(int tag)
Returns the raw tag value (i.e.Directory
getSubDirectory(java.lang.String name)
java.util.Set<java.lang.String>
getSubDirectoryNames()
int[]
getTagCodes()
java.util.Optional<Directory.TagInfo>
getTagInfo(int tag)
Returns information about a tag.java.util.Optional<java.lang.String>
getTagName(int tag)
Returns the name of a tag.java.util.Optional<java.lang.Class<?>>
getTagType(int tag)
Returns the Java type of a tag.int
hashCode()
boolean
isAvailable()
protected boolean
isSubClass(java.lang.Class aClass, java.lang.String ancestorClassName)
void
load(DirectoryLoader loader)
Loads tags and subdirectories from the given loader.protected static java.time.Instant
parseDateTime(java.lang.String string)
void
removeTag(int tag)
void
setObject(int tag, java.lang.Object value)
java.lang.String
toString()
java.lang.String
toString(byte[] array)
java.lang.String
toString(Rational[] array)
protected void
touch()
-
Methods inherited from class it.tidalwave.image.metadata.JavaBeanSupport
addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, addVetoableChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, getVetoableChangeListeners, getVetoableChangeListeners, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, removeVetoableChangeListener
-
-
-
-
Field Detail
-
mapTagInfo
protected static final java.util.Map<java.lang.String,Directory.TagInfo> mapTagInfo
-
-
Method Detail
-
load
public void load(@Nonnull DirectoryLoader loader)
Loads tags and subdirectories from the given loader.
-
getTagCodes
public int[] getTagCodes()
-
getSubDirectoryNames
public java.util.Set<java.lang.String> getSubDirectoryNames()
-
getSubDirectory
public Directory getSubDirectory(java.lang.String name)
-
getRawObject
public java.lang.Object getRawObject(@Nonnegative int tag)
Returns the raw tag value (i.e. exactly as it is stored into the file).- Parameters:
tag
- the tag to retrieve- Returns:
- the value
-
getObject
@Nonnull public <T> java.util.Optional<T> getObject(@Nonnegative int tag, @Nonnull java.lang.Class<T> asType)
Returns a tag value converted to the specified type.- Parameters:
tag
- the tag to retrieveasType
- the type to convert the value into- Returns:
- the value
-
setObject
public void setObject(@Nonnegative int tag, java.lang.Object value)
-
containsTag
public boolean containsTag(@Nonnegative int tag)
- Parameters:
tag
-- Returns:
-
removeTag
public void removeTag(@Nonnegative int tag)
- Parameters:
tag
-
-
getTagInfo
@Nonnull public java.util.Optional<Directory.TagInfo> getTagInfo(@Nonnegative int tag)
Returns information about a tag.- Parameters:
tag
- the tag code- Returns:
- the tag info
-
getTagName
@Nonnull public java.util.Optional<java.lang.String> getTagName(@Nonnegative int tag)
Returns the name of a tag.- Parameters:
tag
- the tag code- Returns:
- the tag name
-
getTagType
@Nonnull public java.util.Optional<java.lang.Class<?>> getTagType(@Nonnegative int tag)
Returns the Java type of a tag.- Parameters:
tag
- the tag code- Returns:
- the tag Java type
-
getLatestModificationTime
@Nonnull public java.time.Instant getLatestModificationTime()
- Returns:
-
isAvailable
public boolean isAvailable()
- Returns:
-
touch
protected void touch()
-
toString
@Nonnull public final java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
toString
public java.lang.String toString(byte[] array)
- Parameters:
array
-- Returns:
-
equals
public final boolean equals(java.lang.Object object)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public final int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString(Rational[] array)
- Parameters:
array
-- Returns:
-
isSubClass
protected boolean isSubClass(java.lang.Class aClass, java.lang.String ancestorClassName)
- Returns:
-
formatDateTime
protected static java.lang.String formatDateTime(java.time.Instant date)
-
parseDateTime
protected static java.time.Instant parseDateTime(java.lang.String string)
-
-