Class MetaDataExtractor

java.lang.Object
NTNU.IDATT1002.utils.MetaDataExtractor

public class MetaDataExtractor
extends java.lang.Object
Class MetaDataExtractor. Extracts metadata and geolocation and histogram from it.
Version:
1.0 06.04.20
Author:
madslun
  • Constructor Summary

    Constructors 
    Constructor Description
    MetaDataExtractor()  
  • Method Summary

    Modifier and Type Method Description
    static java.lang.String getAperture​(java.io.File file)
    Method for getting aperture information
    static java.lang.String getCamera​(java.io.File file)
    Gets the camera Make and Model of the camera used to take the photo
    static java.lang.String getFileDimension​(java.io.File file)
    Method for getting file dimension
    static java.lang.String getFileSize​(java.io.File file)
    Method for getting file size
    static java.lang.String getFileType​(java.io.File file)
    Method for getting file type information
    static java.lang.String getFocalLength​(java.io.File file)
    Method for getting focal length information
    static GeoLocation getGeoLocation​(java.io.File file)
    Reads files' metadata and tries to extract metadata
    static java.lang.String getIso​(java.io.File file)
    Method for getting iso information
    static java.lang.String getLens​(java.io.File file)
    Method for getting lens information of the camera used
    static java.lang.String getMetadata​(java.io.File file)  
    static java.lang.String getMiscMetadata​(java.io.File file)
    Method for getting all the misceleneous metadata from an image.
    static java.lang.String getPhotoDate​(java.io.File file)
    Method for getting date information
    static java.lang.String getShutterSpeed​(java.io.File file)
    Method for getting shutterspeed information
    static void setMetadata​(Metadata metadata, java.io.File file)
    Sets all predefiner metadata on a metadata object

    Methods inherited from class java.lang.Object

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

  • Method Details

    • getGeoLocation

      public static GeoLocation getGeoLocation​(java.io.File file)
      Reads files' metadata and tries to extract metadata
      Returns:
      the gelocation of the file, if none is found, geolocation is set to 0
    • getCamera

      public static java.lang.String getCamera​(java.io.File file)
      Gets the camera Make and Model of the camera used to take the photo
      Parameters:
      file - that will be checked for Camera make
      Returns:
      empty string if nothings found
    • getLens

      public static java.lang.String getLens​(java.io.File file)
      Method for getting lens information of the camera used
      Parameters:
      file - that will be checked
      Returns:
      empty string if nothing is found
    • getAperture

      public static java.lang.String getAperture​(java.io.File file)
      Method for getting aperture information
      Parameters:
      file - that will be checked
      Returns:
      empty string if nothing is found
    • getShutterSpeed

      public static java.lang.String getShutterSpeed​(java.io.File file)
      Method for getting shutterspeed information
      Parameters:
      file - that will be checked
      Returns:
      empty string if nothing is found
    • getIso

      public static java.lang.String getIso​(java.io.File file)
      Method for getting iso information
      Parameters:
      file - that will be checked
      Returns:
      empty string if nothing is found
    • getFocalLength

      public static java.lang.String getFocalLength​(java.io.File file)
      Method for getting focal length information
      Parameters:
      file - that will be checked
      Returns:
      empty string if nothing is found
    • getFileType

      public static java.lang.String getFileType​(java.io.File file)
      Method for getting file type information
      Parameters:
      file - that will be checked
      Returns:
      empty string if nothing is found
    • getPhotoDate

      public static java.lang.String getPhotoDate​(java.io.File file)
      Method for getting date information
      Parameters:
      file - that will be checked
      Returns:
      empty string if nothing is found
    • getFileSize

      public static java.lang.String getFileSize​(java.io.File file)
      Method for getting file size
      Parameters:
      file - that will be checked
      Returns:
      empty string if nothing is found
    • getFileDimension

      public static java.lang.String getFileDimension​(java.io.File file)
      Method for getting file dimension
      Parameters:
      file - that will be checked
      Returns:
      empty string if nothing is found
    • setMetadata

      public static void setMetadata​(Metadata metadata, java.io.File file)
      Sets all predefiner metadata on a metadata object
      Parameters:
      metadata - object that metadata will be set to
      file - for extracting metadata
    • getMetadata

      public static java.lang.String getMetadata​(java.io.File file)
    • getMiscMetadata

      public static java.lang.String getMiscMetadata​(java.io.File file)
      Method for getting all the misceleneous metadata from an image. The data only gets added if its not already extracted OR if its not of the type TRC as that is only a long string of numbers with no viable information for the user, and clogs up the database
      Parameters:
      file - that will be checked
      Returns:
      metadata or an empty string if nothing was found