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 classDirectory.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 booleancontainsTag(int tag)booleanequals(java.lang.Object object)protected static java.lang.StringformatDateTime(java.time.Instant date)java.time.InstantgetLatestModificationTime()<T> java.util.Optional<T>getObject(int tag, java.lang.Class<T> asType)Returns a tag value converted to the specified type.java.lang.ObjectgetRawObject(int tag)Returns the raw tag value (i.e.DirectorygetSubDirectory(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.inthashCode()booleanisAvailable()protected booleanisSubClass(java.lang.Class aClass, java.lang.String ancestorClassName)voidload(DirectoryLoader loader)Loads tags and subdirectories from the given loader.protected static java.time.InstantparseDateTime(java.lang.String string)voidremoveTag(int tag)voidsetObject(int tag, java.lang.Object value)java.lang.StringtoString()java.lang.StringtoString(byte[] array)java.lang.StringtoString(Rational[] array)protected voidtouch()-
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:
toStringin classjava.lang.Object
-
toString
public java.lang.String toString(byte[] array)
- Parameters:
array-- Returns:
-
equals
public final boolean equals(java.lang.Object object)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public final int hashCode()
- Overrides:
hashCodein 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)
-
-