public static @NotNull FileType processTextFromBinaryPresentationOrNull(@NotNull ByteSequence bytes,
                                                                 @NotNull VirtualFile virtualFile,
                                                                 boolean saveDetectedSeparators,
                                                                 boolean saveBOM,
                                                                 @NotNull FileType fileType,
                                                                 @NotNull NotNullFunction<? super CharSequence, ? extends FileType> fileTextProcessor) {
    byte[] buffer = ((ByteArraySequence)bytes).getInternalBuffer();
    DetectResult detectResult = detectInternalCharsetAndSetBOM(virtualFile, buffer, bytes.length(), saveBOM, fileType);
    Charset internalCharset = detectResult.hardCodedCharset;
    CharsetToolkit.GuessedEncoding guessed = detectResult.guessed;
    CharSequence toProcess;
    if (internalCharset == null || guessed == CharsetToolkit.GuessedEncoding.BINARY || guessed == CharsetToolkit.GuessedEncoding.INVALID_UTF8) {
      // the charset was not detected, so the file is likely binary
      toProcess = null;
    }
    else {
      ConvertResult result = convertBytesAndSetSeparator(buffer, bytes.length(), virtualFile, saveDetectedSeparators, detectResult, internalCharset);
      toProcess = result.text;
    }
    return fileTextProcessor.fun(toProcess);
  }
public static @NotNull FileType processTextFromBinaryPresentationOrNull(@NotNull ByteSequence bytes,
                                                                 @NotNull VirtualFile virtualFile,
                                                                 boolean saveDetectedSeparators,
                                                                 boolean saveBOM,
                                                                 @NotNull FileType fileType,
                                                                 @NotNull NotNullFunction<? super CharSequence, ? extends FileType> fileTextProcessor)