code: private void addMetadataFromIFD(IFD ifd, String key, boolean exif) {
      metadata.add(key, ifd);
      for (TagValue tag : ifd.getMetadata().getTags()) {
        if (tag.getCardinality() == 1) {
          abstractTiffType t = tag.getValue().get(0);
          if (t.isIFD()) {
            addMetadataFromIFD((IFD) t, key, true);
          } else if (t.containsMetadata()) {
            try {
              Metadata meta = t.createMetadata();
              metadata.addMetadata(meta);
            } catch (Exception ex) {
              // TODO: What?
            }
          } else {
            if (exif)
              t.setContainer("EXIF");
            metadata.add(tag.getName(), t);
          }
        } else {
          if (exif)
            tag.setContainer("EXIF");
          metadata.add(tag.getName(), tag);
        }
      }
      if (ifd.hasNextIFD()) {
        addMetadataFromIFD(ifd.getNextIFD(), key, false);
      }
    }
docs: Adds the metadata from ifd.
  
  @param ifd the ifd
  @param key the key
  @param exif the exif
  @the tiff tags io exception