org.apache.tika.parser.image
Class ImageMetadataExtractor

java.lang.Object
  extended by org.apache.tika.parser.image.ImageMetadataExtractor

public class ImageMetadataExtractor
extends java.lang.Object

Uses the Metadata Extractor library to read EXIF and IPTC image metadata and map to Tika fields. As of 2.4.0 the library supports jpeg and tiff.


Constructor Summary
ImageMetadataExtractor(Metadata metadata)
           
ImageMetadataExtractor(Metadata metadata, org.apache.tika.parser.image.ImageMetadataExtractor.DirectoryHandler... handlers)
           
 
Method Summary
protected  void handle(java.util.Iterator<com.drew.metadata.Directory> directories)
          Copies extracted tags to tika metadata using registered handlers.
protected  void handle(com.drew.metadata.Metadata metadataExtractor)
          Copies extracted tags to tika metadata using registered handlers.
 void parseJpeg(java.io.InputStream stream)
           
protected  void parseTiff(java.io.InputStream stream)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ImageMetadataExtractor

public ImageMetadataExtractor(Metadata metadata)
Parameters:
metadata - to extract to, using default directory handlers

ImageMetadataExtractor

public ImageMetadataExtractor(Metadata metadata,
                              org.apache.tika.parser.image.ImageMetadataExtractor.DirectoryHandler... handlers)
Parameters:
metadata - to extract to
handlers - handlers in order, note that handlers may override values from earlier handlers
Method Detail

parseJpeg

public void parseJpeg(java.io.InputStream stream)
               throws java.io.IOException,
                      org.xml.sax.SAXException,
                      TikaException
Throws:
java.io.IOException
org.xml.sax.SAXException
TikaException

parseTiff

protected void parseTiff(java.io.InputStream stream)
                  throws java.io.IOException,
                         org.xml.sax.SAXException,
                         TikaException
Throws:
java.io.IOException
org.xml.sax.SAXException
TikaException

handle

protected void handle(com.drew.metadata.Metadata metadataExtractor)
               throws com.drew.metadata.MetadataException
Copies extracted tags to tika metadata using registered handlers.

Parameters:
metadataExtractor - Tag directories from a Metadata Extractor "reader"
Throws:
com.drew.metadata.MetadataException - This method does not handle exceptions from Metadata Extractor

handle

protected void handle(java.util.Iterator<com.drew.metadata.Directory> directories)
               throws com.drew.metadata.MetadataException
Copies extracted tags to tika metadata using registered handlers.

Parameters:
directories - Metadata Extractor Directory instances.
Throws:
com.drew.metadata.MetadataException - This method does not handle exceptions from Metadata Extractor


Copyright © 2007-2011 The Apache Software Foundation. All Rights Reserved.