@Nullable
    @Override
    public ImageFormat determineFormat(byte[] headerBytes, int headerSize) {
      // JSON files must start with a opening curly brace
      if (!ImageFormatCheckerUtils.startsWithPattern(headerBytes, JSON_OBJECT_FIRST_BYTE)) {
        return null;
      }

      // we expect the format version to be in the header of any proper keyframe file
      final String expectedFormatVersionKey = "formatVersion";
      final String headerString = new String(headerBytes);
      if (!headerString.contains(expectedFormatVersionKey)) {
        return null;
      }
      return IMAGE_FORMAT_KEYFRAMES;
    }
Although keyframe files do not have an explicit header, we try to match by looking for a JSON
file start and known mandatory keys.
samples/showcase/src/main/java/com/facebook/fresco/samples/showcase/imageformat/keyframes/KeyframesDecoderExample.java