docs: @Nullable
      private static byte[] processExtendedXMPChunk(@NotNull Metadata metadata, @NotNull byte[] segmentBytes, @NotNull String extendedXMPGUID, @Nullable byte[] extendedXMPBuffer)
      {
          final int extensionPreambleLength = XMP_EXTENSION_JPEG_PREAMBLE.length();
          final int segmentLength = segmentBytes.length;
          final int totalOffset = extensionPreambleLength + EXTENDED_XMP_GUID_LENGTH + EXTENDED_XMP_INT_LENGTH + EXTENDED_XMP_INT_LENGTH;
  
          if (segmentLength >= totalOffset) {
              try {
                  /*
                   * The chunk contains:
                   * - A null-terminated signature string of "http://ns.adobe.com/xmp/extension/".
                   * - A 128-bit GUID stored as a 32-byte ASCII hex string, capital A-F, no null termination.
                   *   The GUID is a 128-bit MD5 digest of the full ExtendedXMP serialization.
                   * - The full length of the ExtendedXMP serialization as a 32-bit unsigned integer
                   * - The offset of this portion as a 32-bit unsigned integer
                   * - The portion of the ExtendedXMP
                   */
                  final SequentialReader reader = new SequentialByteArrayReader(segmentBytes);
                  reader.skip(extensionPreambleLength);
                  final String segmentGUID = reader.getString(EXTENDED_XMP_GUID_LENGTH);
  
                  if (extendedXMPGUID.equals(segmentGUID)) {
                      final int fullLength = (int)reader.getUInt32();
                      final int chunkOffset = (int)reader.getUInt32();
  
                      if (extendedXMPBuffer == null)
                          extendedXMPBuffer = new byte[fullLength];
  
                      if (extendedXMPBuffer.length == fullLength) {
                          System.arraycopy(segmentBytes, totalOffset, extendedXMPBuffer, chunkOffset, segmentLength - totalOffset);
                      } else {
                          XmpDirectory directory = new XmpDirectory();
                          directory.addError(String.format("Inconsistent length for the Extended XMP buffer: %d instead of %d", fullLength, extendedXMPBuffer.length));
                          metadata.addDirectory(directory);
                      }
                  }
              } catch (IOException ex) {
                  XmpDirectory directory = new XmpDirectory();
                  directory.addError(ex.getMessage());
                  metadata.addDirectory(directory);
              }
          }
  
          return extendedXMPBuffer;
      }