com.drew.metadata.Directory Java Examples

The following examples show how to use com.drew.metadata.Directory. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AdobeJpegReader.java    From metadata-extractor with Apache License 2.0 6 votes vote down vote up
public void extract(@NotNull SequentialReader reader, @NotNull Metadata metadata)
{
    Directory directory = new AdobeJpegDirectory();
    metadata.addDirectory(directory);

    try {
        reader.setMotorolaByteOrder(false);

        if (!reader.getString(PREAMBLE.length()).equals(PREAMBLE)) {
            directory.addError("Invalid Adobe JPEG data header.");
            return;
        }

        directory.setInt(AdobeJpegDirectory.TAG_DCT_ENCODE_VERSION, reader.getUInt16());
        directory.setInt(AdobeJpegDirectory.TAG_APP14_FLAGS0, reader.getUInt16());
        directory.setInt(AdobeJpegDirectory.TAG_APP14_FLAGS1, reader.getUInt16());
        directory.setInt(AdobeJpegDirectory.TAG_COLOR_TRANSFORM, reader.getInt8());
    } catch (IOException ex) {
        directory.addError("IO exception processing data: " + ex.getMessage());
    }
}
 
Example #2
Source File: ExtractImageMetadata.java    From localization_nifi with Apache License 2.0 6 votes vote down vote up
private Map<String, String> getTags(Integer max, Metadata metadata) {
    Map<String, String> results = new HashMap<>();
    int i =0;

    for (Directory directory : metadata.getDirectories()) {
        for (Tag tag : directory.getTags()) {
            results.put(directory.getName() + "." + tag.getTagName(), tag.getDescription());

            if(max!=null) {
                i++;
                if (i >= max) {
                    return results;
                }
            }
        }
    }

    return results;
}
 
Example #3
Source File: MetadataProcessor.java    From FakeImageDetection with GNU General Public License v3.0 6 votes vote down vote up
public MetadataProcessor(File imageFile) {
    this.imageFile = imageFile;
    try {
        data = ImageMetadataReader.readMetadata(imageFile);
    } catch (Exception ex) {
        Logger.getLogger(MetadataProcessor.class.getName()).log(Level.SEVERE, null, ex);
    }
    
    for (Directory directory : data.getDirectories()) {
        extracted_data += String.format("----------------------------------------------%15s---------------------------------\n", directory.getName());
        for (Tag tag : directory.getTags()) {
            extracted_data += tag + "\n";
        }
        if (directory.hasErrors()) {
            for (String error : directory.getErrors()) {
                System.err.println("ERROR: " + error);
            }
        }
    }
}
 
Example #4
Source File: MetaDataTreeTableModel.java    From Pixelitor with GNU General Public License v3.0 6 votes vote down vote up
DirNode(Directory dir) {
    this.dir = dir;
    Collection<Tag> tags = dir.getTags();
    int tagIndex = 0;
    for (Tag tag : tags) {
        String tagName = tag.getTagName();
        if (tagName.startsWith("Unknown")) {
            continue;
        }
        String description = tag.getDescription();
        if (description != null && description.startsWith("Unknown")) {
            continue;
        }
        nodes.add(new TagNode(tagName, description, tagIndex));
        tagIndex++;
    }
}
 
Example #5
Source File: ImageResource.java    From entando-components with GNU Lesser General Public License v3.0 6 votes vote down vote up
protected Map<String, String> getImgMetadata(File file, List<String> ignoreKeysList) {
    logger.debug("Get image Metadata in Resource Action");
    Map<String, String> meta = new HashMap<>();
    try {
        Metadata metadata = ImageMetadataReader.readMetadata(file);

        for (Directory directory : metadata.getDirectories()) {
            for (Tag tag : directory.getTags()) {
                if (!ignoreKeysList.contains(tag.getTagName())) {
                    logger.debug("Add Metadata with key: {}", tag.getTagName());
                    meta.put(tag.getTagName(), tag.getDescription());
                } else {
                    logger.debug("Skip Metadata key {}", tag.getTagName());
                }
            }
        }
    } catch (ImageProcessingException|IOException ex) {
        logger.error("Error reading image metadata for file {}", file.getName(), ex);
    }
    return meta;
}
 
Example #6
Source File: ExifDirectoryTest.java    From metadata-extractor with Apache License 2.0 6 votes vote down vote up
@Test
public void testGetDirectoryName() throws Exception
{
    Directory subIFDDirectory = new ExifSubIFDDirectory();
    Directory ifd0Directory = new ExifIFD0Directory();
    Directory thumbDirectory = new ExifThumbnailDirectory();
    Directory gpsDirectory = new GpsDirectory();

    assertFalse(subIFDDirectory.hasErrors());
    assertFalse(ifd0Directory.hasErrors());
    assertFalse(thumbDirectory.hasErrors());
    assertFalse(gpsDirectory.hasErrors());

    assertEquals("Exif IFD0", ifd0Directory.getName());
    assertEquals("Exif SubIFD", subIFDDirectory.getName());
    assertEquals("Exif Thumbnail", thumbDirectory.getName());
    assertEquals("GPS", gpsDirectory.getName());
}
 
Example #7
Source File: XmpReader.java    From metadata-extractor with Apache License 2.0 6 votes vote down vote up
/**
 * Performs the XMP data extraction, adding found values to the specified instance of {@link Metadata}.
 * <p>
 * The extraction is done with Adobe's XMPCore library.
 */
public void extract(@NotNull final String xmpString, @NotNull Metadata metadata, @Nullable Directory parentDirectory)
{
    XmpDirectory directory = new XmpDirectory();

    if (parentDirectory != null)
        directory.setParent(parentDirectory);

    try {
        XMPMeta xmpMeta = XMPMetaFactory.parseFromString(xmpString, PARSE_OPTIONS);
        directory.setXMPMeta(xmpMeta);
    } catch (XMPException e) {
        directory.addError("Error processing XMP data: " + e.getMessage());
    }

    if (!directory.isEmpty())
        metadata.addDirectory(directory);
}
 
Example #8
Source File: ExifTiffHandler.java    From metadata-extractor with Apache License 2.0 6 votes vote down vote up
private static boolean handlePrintIM(@NotNull final Directory directory, final int tagId)
{
    if (tagId == ExifDirectoryBase.TAG_PRINT_IMAGE_MATCHING_INFO)
        return true;

    if (tagId == 0x0E00) {
        // Tempting to say every tagid of 0x0E00 is a PIM tag, but can't be 100% sure
        if (directory instanceof CasioType2MakernoteDirectory ||
            directory instanceof KyoceraMakernoteDirectory ||
            directory instanceof NikonType2MakernoteDirectory ||
            directory instanceof OlympusMakernoteDirectory ||
            directory instanceof PanasonicMakernoteDirectory ||
            directory instanceof PentaxMakernoteDirectory ||
            directory instanceof RicohMakernoteDirectory ||
            directory instanceof SanyoMakernoteDirectory ||
            directory instanceof SonyType1MakernoteDirectory)
            return true;
    }

    return false;
}
 
Example #9
Source File: ExtractImageMetadata.java    From nifi with Apache License 2.0 6 votes vote down vote up
private Map<String, String> getTags(Integer max, Metadata metadata) {
    Map<String, String> results = new HashMap<>();
    int i =0;

    for (Directory directory : metadata.getDirectories()) {
        for (Tag tag : directory.getTags()) {
            results.put(directory.getName() + "." + tag.getTagName(), tag.getDescription());

            if(max!=null) {
                i++;
                if (i >= max) {
                    return results;
                }
            }
        }
    }

    return results;
}
 
Example #10
Source File: ProcessAllImagesInFolderUtility.java    From metadata-extractor with Apache License 2.0 6 votes vote down vote up
private static void writeHierarchyLevel(@NotNull Metadata metadata, @NotNull PrintWriter writer, @Nullable Directory parent, int level)
{
    final int indent = 4;

    for (Directory child : metadata.getDirectories()) {
        if (parent == null) {
            if (child.getParent() != null)
                continue;
        } else if (!parent.equals(child.getParent())) {
            continue;
        }

        for (int i = 0; i < level*indent; i++) {
            writer.write(' ');
        }
        writer.write("- ");
        writer.write(child.getName());
        writer.write(NEW_LINE);
        writeHierarchyLevel(metadata, writer, child, level + 1);
    }
}
 
Example #11
Source File: ResourceAction.java    From entando-components with GNU Lesser General Public License v3.0 5 votes vote down vote up
protected Map getImgMetadata(File file) {
    logger.debug("Get image Metadata in Resource Action");
    Map<String, String> meta = new HashMap<>();
    ResourceInterface resourcePrototype = this.getResourceManager().createResourceType(this.getResourceType());
    try {
        Metadata metadata = ImageMetadataReader.readMetadata(file);
        String ignoreKeysConf = resourcePrototype.getMetadataIgnoreKeys();
        String[] ignoreKeys = null;
        if (null != ignoreKeysConf) {
            ignoreKeys = ignoreKeysConf.split(",");
            logger.debug("Metadata ignoreKeys: {}", ignoreKeys);
        } else {
            logger.debug("Metadata ignoreKeys not configured");
        }
        List<String> ignoreKeysList = new ArrayList<String>();
        if (null != ignoreKeys) {
            ignoreKeysList = Arrays.asList(ignoreKeys);
        }
        for (Directory directory : metadata.getDirectories()) {
            for (Tag tag : directory.getTags()) {
                if (!ignoreKeysList.contains(tag.getTagName())) {
                    logger.debug("Add Metadata with key: {}", tag.getTagName());
                    meta.put(tag.getTagName(), tag.getDescription());
                } else {
                    logger.debug("Skip Metadata key {}", tag.getTagName());
                }
            }
        }
    } catch (ImageProcessingException ex) {
        logger.error("Error reading metadata from file " + this.getFileName() + " - message " + ex.getMessage());
    } catch (IOException ioex) {
        logger.error("Error reading file", ioex);
    }
    return meta;
}
 
Example #12
Source File: ProcessAllImagesInFolderUtility.java    From metadata-extractor with Apache License 2.0 5 votes vote down vote up
@Override
public void onExtractionSuccess(@NotNull File file, @NotNull Metadata metadata, @NotNull String relativePath, @NotNull PrintStream log)
{
    super.onExtractionSuccess(file, metadata, relativePath, log);

    for (Directory directory : metadata.getDirectories()) {
        for (Tag tag : directory.getTags()) {

            // Only interested in unknown tags (those without names)
            if (tag.hasTagName())
                continue;

            HashMap<Integer, Integer> occurrenceCountByTag = _occurrenceCountByTagByDirectory.get(directory.getName());
            if (occurrenceCountByTag == null) {
                occurrenceCountByTag = new HashMap<Integer, Integer>();
                _occurrenceCountByTagByDirectory.put(directory.getName(), occurrenceCountByTag);
            }

            Integer count = occurrenceCountByTag.get(tag.getTagType());
            if (count == null) {
                count = 0;
                occurrenceCountByTag.put(tag.getTagType(), 0);
            }

            occurrenceCountByTag.put(tag.getTagType(), count + 1);
        }
    }
}
 
Example #13
Source File: GenericMetadataDirectory.java    From Bats with Apache License 2.0 5 votes vote down vote up
public void setDPIWidth(Directory directory, int tagType) {
  try {
    setDPIWidth(directory.getInt(tagType));
  } catch (MetadataException e) {
    // Nothing needs to be done
  }
}
 
Example #14
Source File: GenericMetadataDirectory.java    From Bats with Apache License 2.0 5 votes vote down vote up
public void setDPIHeight(Directory directory, int tagType) {
  try {
    setDPIHeight(directory.getInt(tagType));
  } catch (MetadataException e) {
    // Nothing needs to be done
  }
}
 
Example #15
Source File: GenericMetadataDirectory.java    From Bats with Apache License 2.0 5 votes vote down vote up
public void setDPIWidth(Directory directory, int tagType, double factor) {
  try {
    setDPIWidth(directory.getInt(tagType) * factor);
  } catch (MetadataException e) {
    // Nothing needs to be done
  }
}
 
Example #16
Source File: GenericMetadataDirectory.java    From Bats with Apache License 2.0 5 votes vote down vote up
public void setDPIHeight(Directory directory, int tagType, double factor) {
  try {
    setDPIHeight(directory.getInt(tagType) * factor);
  } catch (MetadataException e) {
    // Nothing needs to be done
  }
}
 
Example #17
Source File: RotateImgUtils.java    From spring-boot with Apache License 2.0 5 votes vote down vote up
/**
 * 获取图片正确显示需要旋转的角度(顺时针)
 *
 * @return
 * @throws Exception
 */
private static final int getRotateAngle(File file) throws TSException {
    int angle = 0;
    Metadata metadata;
    try {
        metadata = JpegMetadataReader.readMetadata(file);
        Directory directory = metadata.getDirectory(ExifDirectory.class);
        if (directory.containsTag(ExifDirectory.TAG_ORIENTATION)) {
            // Exif信息中方向  
            int orientation = directory.getInt(ExifDirectory.TAG_ORIENTATION);
            // 原图片的方向信息
            if (6 == orientation) {
                //6旋转90
                angle = 90;
            } else if (3 == orientation) {
                //3旋转180
                angle = 180;
            } else if (8 == orientation) {
                //8旋转90
                angle = 270;
            }
        }
    } catch (Exception e) {
        throw new TSException(TSEDictionary.UNDEFINED_FAIL.getCode(), "iphone图片服务器旋转异常");
    }
    return angle;
}
 
Example #18
Source File: MutableImage.java    From react-native-camera-face-detector with MIT License 5 votes vote down vote up
public void writeDataToFile(File file, ReadableMap options, int jpegQualityPercent) throws IOException {
    FileOutputStream fos = new FileOutputStream(file);
    fos.write(toJpeg(currentRepresentation, jpegQualityPercent));
    fos.close();

    try {
        ExifInterface exif = new ExifInterface(file.getAbsolutePath());

        // copy original exif data to the output exif...
        // unfortunately, this Android ExifInterface class doesn't understand all the tags so we lose some
        for (Directory directory : originalImageMetaData().getDirectories()) {
            for (Tag tag : directory.getTags()) {
                int tagType = tag.getTagType();
                Object object = directory.getObject(tagType);
                exif.setAttribute(tag.getTagName(), object.toString());
            }
        }

        writeLocationExifData(options, exif);

        if(hasBeenReoriented)
            rewriteOrientation(exif);

        exif.saveAttributes();
    } catch (ImageProcessingException  | IOException e) {
        Log.e(TAG, "failed to save exif data", e);
    }
}
 
Example #19
Source File: ProcessAllImagesInFolderUtility.java    From metadata-extractor with Apache License 2.0 5 votes vote down vote up
public void onExtractionSuccess(@NotNull File file, @NotNull Metadata metadata, @NotNull String relativePath, @NotNull PrintStream log)
{
    if (metadata.hasErrors()) {
        log.print(file);
        log.print('\n');
        for (Directory directory : metadata.getDirectories()) {
            if (!directory.hasErrors())
                continue;
            for (String error : directory.getErrors()) {
                log.printf("\t[%s] %s\n", directory.getName(), error);
                _errorCount++;
            }
        }
    }
}
 
Example #20
Source File: CreateFilePane.java    From pattypan with MIT License 5 votes vote down vote up
/**
 *
 * @param filePath
 * @return
 */
private String getExifDate(File file) {

  try {
    Metadata metadata = ImageMetadataReader.readMetadata(file);
    Directory directory = metadata.getFirstDirectoryOfType(ExifSubIFDDirectory.class);
    int dateTag = ExifSubIFDDirectory.TAG_DATETIME_ORIGINAL;

    if (directory != null && directory.containsTag(dateTag)) {
      Date date = directory.getDate(dateTag, TimeZone.getDefault());
      return new SimpleDateFormat("yyyy-MM-dd HH:mm").format(date);
    } else {
      return "";
    }
  } catch (ImageProcessingException | IOException ex) {
    Session.LOGGER.log(Level.INFO, 
        "Exif error for {0}: {1}",
        new String[]{file.getName(), ex.getLocalizedMessage()}
    );
    return "";
  }
}
 
Example #21
Source File: ExifReaderTest.java    From metadata-extractor with Apache License 2.0 5 votes vote down vote up
@NotNull
public static <T extends Directory> T processBytes(@NotNull String filePath, @NotNull Class<T> directoryClass) throws IOException
{
    T directory = processBytes(filePath).getFirstDirectoryOfType(directoryClass);
    assertNotNull(directory);
    return directory;
}
 
Example #22
Source File: SampleProcessor.java    From tutorials with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override
protected void process(Record record, SingleLaneBatchMaker batchMaker) throws StageException {
  LOG.info("Input record: {}", record);

  FileRef fileRef = record.get("/fileRef").getValueAsFileRef();
  Metadata metadata;
  try {
    metadata = ImageMetadataReader.readMetadata(fileRef.createInputStream(getContext(), InputStream.class));
  } catch (ImageProcessingException | IOException e) {
    String filename = record.get("/fileInfo/filename").getValueAsString();
    LOG.info("Exception getting metadata from {}", filename, e);
    throw new OnRecordErrorException(record, Errors.SAMPLE_02, e);
  }

  for (Directory directory : metadata.getDirectories()) {
    LinkedHashMap<String, Field> listMap = new LinkedHashMap<>();

    for (Tag tag : directory.getTags()) {
      listMap.put(tag.getTagName(), Field.create(tag.getDescription()));
    }

    if (directory.hasErrors()) {
      for (String error : directory.getErrors()) {
        LOG.info("ERROR: {}", error);
      }
    }

    record.set("/" + directory.getName(), Field.createListMap(listMap));
  }

  LOG.info("Output record: {}", record);

  batchMaker.addRecord(record);
}
 
Example #23
Source File: ProcessAllImagesInFolderUtility.java    From metadata-extractor with Apache License 2.0 5 votes vote down vote up
Row(@NotNull File file, @NotNull Metadata metadata, @NotNull String relativePath)
{
    this.file = file;
    this.metadata = metadata;
    this.relativePath = relativePath;

    ExifIFD0Directory ifd0Dir = metadata.getFirstDirectoryOfType(ExifIFD0Directory.class);
    ExifSubIFDDirectory subIfdDir = metadata.getFirstDirectoryOfType(ExifSubIFDDirectory.class);
    ExifThumbnailDirectory thumbDir = metadata.getFirstDirectoryOfType(ExifThumbnailDirectory.class);
    if (ifd0Dir != null) {
        manufacturer = ifd0Dir.getDescription(ExifIFD0Directory.TAG_MAKE);
        model = ifd0Dir.getDescription(ExifIFD0Directory.TAG_MODEL);
    }
    boolean hasMakernoteData = false;
    if (subIfdDir != null) {
        exifVersion = subIfdDir.getDescription(ExifSubIFDDirectory.TAG_EXIF_VERSION);
        hasMakernoteData = subIfdDir.containsTag(ExifSubIFDDirectory.TAG_MAKERNOTE);
    }
    if (thumbDir != null) {
        Integer width = thumbDir.getInteger(ExifThumbnailDirectory.TAG_IMAGE_WIDTH);
        Integer height = thumbDir.getInteger(ExifThumbnailDirectory.TAG_IMAGE_HEIGHT);
        thumbnail = width != null && height != null
            ? String.format("Yes (%s x %s)", width, height)
            : "Yes";
    }
    for (Directory directory : metadata.getDirectories()) {
        if (directory.getClass().getName().contains("Makernote")) {
            makernote = directory.getName().replace("Makernote", "").trim();
            break;
        }
    }
    if (makernote == null) {
        makernote = hasMakernoteData ? "(Unknown)" : "N/A";
    }
}
 
Example #24
Source File: ExifSubIFDDirectory.java    From metadata-extractor with Apache License 2.0 5 votes vote down vote up
/**
 * Parses the date/time tag, the subsecond tag and the time offset tag to obtain a single Date
 * object with milliseconds representing the date and time when this image was modified.  If
 * the time offset tag does not exist, attempts will be made to parse the values as though it is
 * in the {@link TimeZone} represented by the {@code timeZone} parameter (if it is non-null).
 *
 * @param timeZone the time zone to use
 * @return A Date object representing when this image was modified, if possible, otherwise null
 */
@Nullable
public Date getDateModified(@Nullable TimeZone timeZone)
{
    Directory parent = getParent();
    if (parent instanceof ExifIFD0Directory) {
        TimeZone timeZoneModified = getTimeZone(TAG_TIME_ZONE);
        return parent.getDate(TAG_DATETIME, getString(TAG_SUBSECOND_TIME),
            (timeZoneModified != null) ? timeZoneModified : timeZone);
    } else {
        return null;
    }
}
 
Example #25
Source File: JpegMetadataReaderTest.java    From metadata-extractor with Apache License 2.0 5 votes vote down vote up
private void validate(Metadata metadata)
{
    Directory directory = metadata.getFirstDirectoryOfType(ExifSubIFDDirectory.class);
    assertNotNull(directory);
    assertEquals("80", directory.getString(ExifSubIFDDirectory.TAG_ISO_EQUIVALENT));
    directory = metadata.getFirstDirectoryOfType(HuffmanTablesDirectory.class);
    assertNotNull(directory);
    assertTrue(((HuffmanTablesDirectory) directory).isOptimized());
}
 
Example #26
Source File: JpegMetadataReaderTest.java    From metadata-extractor with Apache License 2.0 5 votes vote down vote up
@Test
public void testTypicalHuffman() throws Exception
{
    Metadata metadata = JpegMetadataReader.readMetadata(new File("Tests/Data/withTypicalHuffman.jpg"));
    Directory directory = metadata.getFirstDirectoryOfType(HuffmanTablesDirectory.class);
    assertNotNull(directory);
    assertTrue(((HuffmanTablesDirectory) directory).isTypical());
    assertFalse(((HuffmanTablesDirectory) directory).isOptimized());
    for (int i = 0; i < ((HuffmanTablesDirectory) directory).getNumberOfTables(); i++) {
        HuffmanTable table = ((HuffmanTablesDirectory) directory).getTable(i);
        assertTrue(table.isTypical());
        assertFalse(table.isOptimized());
    }
}
 
Example #27
Source File: IccReader.java    From metadata-extractor with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings({"SameParameterValue"})
private void setInt64(@NotNull Directory directory, int tagType, @NotNull RandomAccessReader reader) throws IOException
{
    long l = reader.getInt64(tagType);
    if (l != 0)
        directory.setLong(tagType, l);
}
 
Example #28
Source File: JpegMetadataReaderTest.java    From metadata-extractor with Apache License 2.0 5 votes vote down vote up
@Test
public void testExtractXmpMetadata() throws Exception
{
    Metadata metadata = JpegMetadataReader.readMetadata(new File("Tests/Data/withXmp.jpg"));
    Directory directory = metadata.getFirstDirectoryOfType(XmpDirectory.class);
    assertNotNull(directory);
    directory = metadata.getFirstDirectoryOfType(HuffmanTablesDirectory.class);
    assertNotNull(directory);
    assertTrue(((HuffmanTablesDirectory) directory).isOptimized());
}
 
Example #29
Source File: XmpReader.java    From metadata-extractor with Apache License 2.0 5 votes vote down vote up
/**
 * Performs the XMP data extraction, adding found values to the specified instance of {@link Metadata}.
 * <p>
 * The extraction is done with Adobe's XMPCore library.
 */
public void extract(@NotNull final byte[] xmpBytes, int offset, int length, @NotNull Metadata metadata, @Nullable Directory parentDirectory)
{
    XmpDirectory directory = new XmpDirectory();

    if (parentDirectory != null)
        directory.setParent(parentDirectory);

    try {
        XMPMeta xmpMeta;

        // If all xmpBytes are requested, no need to make a new ByteBuffer
        if (offset == 0 && length == xmpBytes.length) {
            xmpMeta = XMPMetaFactory.parseFromBuffer(xmpBytes, PARSE_OPTIONS);
        } else {
            ByteBuffer buffer = new ByteBuffer(xmpBytes, offset, length);
            xmpMeta = XMPMetaFactory.parse(buffer.getByteStream(), PARSE_OPTIONS);
        }

        directory.setXMPMeta(xmpMeta);
    } catch (XMPException e) {
        directory.addError("Error processing XMP data: " + e.getMessage());
    }

    if (!directory.isEmpty())
        metadata.addDirectory(directory);
}
 
Example #30
Source File: ProcessAllImagesInFolderUtility.java    From metadata-extractor with Apache License 2.0 5 votes vote down vote up
@Override
public void onExtractionSuccess(@NotNull File file, @NotNull Metadata metadata, @NotNull String relativePath, @NotNull PrintStream log)
{
    super.onExtractionSuccess(file, metadata, relativePath, log);

    // Iterate through all values, calling toString to flush out any formatting exceptions
    for (Directory directory : metadata.getDirectories()) {
        directory.getName();
        for (Tag tag : directory.getTags()) {
            tag.getTagName();
            tag.getDescription();
        }
    }
}