docs: @NotNull
      public static FileType detectFileType(@NotNull final BufferedInputStream inputStream) throws IOException
      {
          if (!inputStream.markSupported())
              throw new IOException("Stream must support mark/reset");
  
          int maxByteCount = Math.max(16, _root.getMaxDepth());
  
          inputStream.mark(maxByteCount);
  
          byte[] bytes = new byte[maxByteCount];
          int bytesRead = inputStream.read(bytes);
  
          if (bytesRead == -1)
              throw new IOException("Stream ended before file's magic number could be determined.");
  
          inputStream.reset();
  
          FileType fileType = _root.find(bytes);
  
          assert(fileType != null);
  
          if (fileType == FileType.Unknown) {
              String eightCC = new String(bytes, 4, 8);
              // Test at offset 4 for Base Media Format (i.e. QuickTime, MP4, etc...) identifier "ftyp" plus four identifying characters
              FileType t = _ftypMap.get(eightCC);
              if (t != null)
                  return t;
          } else if (fileType == FileType.Riff) {
              String fourCC = new String(bytes, 8, 4);
              if (fourCC.equals("WAVE"))
                  return FileType.Wav;
              if (fourCC.equals("AVI "))
                  return FileType.Avi;
              if (fourCC.equals("WEBP"))
                  return FileType.WebP;
          }
  
          return fileType;
      }