]> gitweb.fperrin.net Git - GpsPrune.git/blob - tim/prune/jpeg/InternalExifLibrary.java
Version 10, May 2010
[GpsPrune.git] / tim / prune / jpeg / InternalExifLibrary.java
1 package tim.prune.jpeg;
2
3 import java.io.File;
4 import tim.prune.jpeg.drew.ExifReader;
5 import tim.prune.jpeg.drew.JpegException;
6
7 /**
8  * Class to act as a gateway into the internal exif library functions.
9  * This should be the only class with dependence on the jpeg.drew package.
10  * Should not be included if external library will be used (eg Debian).
11  */
12 public class InternalExifLibrary implements ExifLibrary
13 {
14         /**
15          * Use the _internal_ exif library to get the data from the given file
16          * @param inFile file to access
17          * @return Jpeg data if available, otherwise null
18          */
19         public JpegData getJpegData(File inFile)
20         {
21                 JpegData data = null;
22                 try {
23                         data = new ExifReader(inFile).extract();
24                 }
25                 catch (JpegException jpe) {} // data remains null
26                 return data;
27         }
28
29         /**
30          * Check whether the exifreader class can be correctly resolved
31          * @return true if it looks ok
32          */
33         public boolean looksOK()
34         {
35                 try {
36                         String test = ExifReader.class.getName();
37                         if (test != null) return true;
38                 }
39                 catch (LinkageError le) {}
40                 return false;
41         }
42 }