public void testExtractMetadata() throws Exception { File withExif = new File("Source/com/drew/metadata/exif/test/withExif.jpg"); Metadata metadata = JpegMetadataReader.readMetadata(withExif); assertTrue(metadata.containsDirectory(ExifDirectory.class)); Directory directory = metadata.getDirectory(ExifDirectory.class); assertEquals("80", directory.getString(ExifDirectory.TAG_ISO_EQUIVALENT)); }
@Test public void testExtractMetadataUsingInputStream() throws Exception { File withExif = new File("Tests/com/drew/metadata/exif/withExif.jpg"); InputStream in = new BufferedInputStream(new FileInputStream((withExif))); Metadata metadata = JpegMetadataReader.readMetadata(in); Assert.assertTrue(metadata.containsDirectory(ExifSubIFDDirectory.class)); Directory directory = metadata.getOrCreateDirectory(ExifSubIFDDirectory.class); Assert.assertEquals("80", directory.getString(ExifSubIFDDirectory.TAG_ISO_EQUIVALENT)); }