Class ImageMetadataReader

    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private ImageMetadataReader()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void main​(java.lang.String[] args)
      An application entry point.
      static Metadata readMetadata​(java.io.File file)
      Reads Metadata from a File object.
      static Metadata readMetadata​(java.io.InputStream inputStream)
      Reads metadata from an InputStream.
      static Metadata readMetadata​(java.io.InputStream inputStream, long streamLength)
      Reads metadata from an InputStream of known length.
      static Metadata readMetadata​(java.io.InputStream inputStream, long streamLength, FileType fileType)
      Reads metadata from an InputStream of known length and file type.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ImageMetadataReader

        private ImageMetadataReader()
                             throws java.lang.Exception
        Throws:
        java.lang.Exception
    • Method Detail

      • readMetadata

        public static Metadata readMetadata​(java.io.InputStream inputStream)
                                     throws ImageProcessingException,
                                            java.io.IOException
        Reads metadata from an InputStream.
        Parameters:
        inputStream - a stream from which the file data may be read. The stream must be positioned at the beginning of the file's data.
        Returns:
        a populated Metadata object containing directories of tags with values and any processing errors.
        Throws:
        ImageProcessingException - if the file type is unknown, or for general processing errors.
        java.io.IOException
      • readMetadata

        public static Metadata readMetadata​(java.io.InputStream inputStream,
                                            long streamLength)
                                     throws ImageProcessingException,
                                            java.io.IOException
        Reads metadata from an InputStream of known length.
        Parameters:
        inputStream - a stream from which the file data may be read. The stream must be positioned at the beginning of the file's data.
        streamLength - the length of the stream, if known, otherwise -1.
        Returns:
        a populated Metadata object containing directories of tags with values and any processing errors.
        Throws:
        ImageProcessingException - if the file type is unknown, or for general processing errors.
        java.io.IOException
      • readMetadata

        public static Metadata readMetadata​(java.io.InputStream inputStream,
                                            long streamLength,
                                            FileType fileType)
                                     throws java.io.IOException,
                                            ImageProcessingException
        Reads metadata from an InputStream of known length and file type.
        Parameters:
        inputStream - a stream from which the file data may be read. The stream must be positioned at the beginning of the file's data.
        streamLength - the length of the stream, if known, otherwise -1.
        fileType - the file type of the data stream.
        Returns:
        a populated Metadata object containing directories of tags with values and any processing errors.
        Throws:
        ImageProcessingException - if the file type is unknown, or for general processing errors.
        java.io.IOException
      • readMetadata

        public static Metadata readMetadata​(java.io.File file)
                                     throws ImageProcessingException,
                                            java.io.IOException
        Reads Metadata from a File object.
        Parameters:
        file - a file from which the image data may be read.
        Returns:
        a populated Metadata object containing directories of tags with values and any processing errors.
        Throws:
        ImageProcessingException - for general processing errors.
        java.io.IOException
      • main

        public static void main​(java.lang.String[] args)
        An application entry point. Takes the name of one or more files as arguments and prints the contents of all metadata directories to System.out.

        If -thumb is passed, then any thumbnail data will be written to a file with name of the input file having .thumb.jpg appended.

        If -markdown is passed, then output will be in markdown format.

        If -hex is passed, then the ID of each tag will be displayed in hexadecimal.

        Parameters:
        args - the command line arguments