Class 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
    • Field Detail

      • mapTagInfo

        protected static final java.util.Map<java.lang.String,​Directory.TagInfo> mapTagInfo
    • Constructor Detail

      • Directory

        public Directory()
      • Directory

        public Directory​(@Nonnull
                         java.time.Instant latestModificationTime)
    • 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 retrieve
        asType - 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 class java.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 class java.lang.Object
      • hashCode

        public final int hashCode()
        Overrides:
        hashCode in class java.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)