Class ExtentReader

Object
ExtentReader

public class ExtentReader extends Object
Reads an Extent from the Metadata tags of a file.
  • Method Summary

    Modifier and Type
    Method
    Description
    read(com.drew.metadata.Directory directory, int tagWidth, int tagHeight)
    Reads two metadata entries, representing width and height, and use them to form a Extent.
    static <T extends com.drew.metadata.Directory>
    Optional<Extent>
    read(com.drew.metadata.Metadata metadata, Class<T> directoryType, int tagWidth, int tagHeight)
    Reads two metadata entries, representing width and height, and use them to form a Extent.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • read

      public static <T extends com.drew.metadata.Directory> Optional<Extent> read(com.drew.metadata.Metadata metadata, Class<T> directoryType, int tagWidth, int tagHeight) throws ImageIOException
      Reads two metadata entries, representing width and height, and use them to form a Extent.

      The first directory of type directoryType is used for the tags.

      Type Parameters:
      T - directory-type to find
      Parameters:
      metadata - the metadata to read from.
      directoryType - class corresponding to T.
      tagWidth - a unique identifier from the metadata-extractor library identifying the width tag.
      tagHeight - a unique identifier from the metadata-extractor library identifying the height tag.
      Returns:
      the value of the tag, or Optional.empty() if it does not exist.
      Throws:
      ImageIOException - if the metadata is errored (but not if it is absent).
    • read

      public static Optional<Extent> read(com.drew.metadata.Directory directory, int tagWidth, int tagHeight) throws ImageIOException
      Reads two metadata entries, representing width and height, and use them to form a Extent.
      Parameters:
      directory - the directory to read tags from.
      tagWidth - a unique identifier from the metadata-extractor library identifying the width tag.
      tagHeight - a unique identifier from the metadata-extractor library identifying the height tag.
      Returns:
      the value of the tag, or Optional.empty() if it does not exist.
      Throws:
      ImageIOException - if the metadata is errored (but not if it is absent).