docs: 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);
              } else {
                  ByteBuffer buffer = new ByteBuffer(xmpBytes, offset, length);
                  xmpMeta = XMPMetaFactory.parse(buffer.getByteStream());
              }
  
              directory.setXMPMeta(xmpMeta);
          } catch (XMPException e) {
              directory.addError("Error processing XMP data: " + e.getMessage());
          }
  
          if (!directory.isEmpty())
              metadata.addDirectory(directory);
      }