X-Git-Url: https://gitweb.fperrin.net/?a=blobdiff_plain;f=tim%2Fprune%2Fjpeg%2FInternalExifLibrary.java;fp=tim%2Fprune%2Fjpeg%2FInternalExifLibrary.java;h=c8b17089990bc405ada9492ab06bdc3937674200;hb=c0387c124840c9407e040600fda88f3c3e8f6aa6;hp=0000000000000000000000000000000000000000;hpb=1ee49ae3c8ef3aa2e63eadd458531e5f8bd4f92c;p=GpsPrune.git diff --git a/tim/prune/jpeg/InternalExifLibrary.java b/tim/prune/jpeg/InternalExifLibrary.java new file mode 100644 index 0000000..c8b1708 --- /dev/null +++ b/tim/prune/jpeg/InternalExifLibrary.java @@ -0,0 +1,42 @@ +package tim.prune.jpeg; + +import java.io.File; +import tim.prune.jpeg.drew.ExifReader; +import tim.prune.jpeg.drew.JpegException; + +/** + * Class to act as a gateway into the internal exif library functions. + * This should be the only class with dependence on the jpeg.drew package. + * Should not be included if external library will be used (eg Debian). + */ +public class InternalExifLibrary implements ExifLibrary +{ + /** + * Use the _internal_ exif library to get the data from the given file + * @param inFile file to access + * @return Jpeg data if available, otherwise null + */ + public JpegData getJpegData(File inFile) + { + JpegData data = null; + try { + data = new ExifReader(inFile).extract(); + } + catch (JpegException jpe) {} // data remains null + return data; + } + + /** + * Check whether the exifreader class can be correctly resolved + * @return true if it looks ok + */ + public boolean looksOK() + { + try { + String test = ExifReader.class.getName(); + if (test != null) return true; + } + catch (LinkageError le) {} + return false; + } +}