private static Directory getMetaDirectory(File file) { try { Metadata metadata = JpegMetadataReader.readMetadata(file); return metadata.getDirectory(ExifDirectory.class); } catch (JpegProcessingException e) { e.printStackTrace(); } return null; }
/* (non-Javadoc) * @see org.inbio.m3s.dao.multimedia.MetadataExtractorDAO#init(java.lang.String) */ public void init(String fileAddress) throws IllegalArgumentException { logger.info("using the fileAddress: '" + fileAddress + "'"); this.fileAddress = fileAddress; try { File jpegFile = new File(fileAddress); Metadata metadata = JpegMetadataReader.readMetadata(jpegFile); this.exifDirectory = metadata.getDirectory(ExifDirectory.class); } catch (JpegProcessingException e) { e.printStackTrace(); throw new IllegalArgumentException( "The fileAddress [" + fileAddress + "] doesn't exist. ", e.getCause()); } }