private static @NotNull ConvertResult convertBytesAndSetSeparator(byte @NotNull [] bytes,
                                                                    int length,
                                                                    @NotNull VirtualFile virtualFile,
                                                                    boolean saveDetectedSeparators,
                                                                    @NotNull DetectResult info,
                                                                    @NotNull Charset internalCharset) {
    byte[] bom = info.BOM;
    int BOMEndOffset = Math.min(length, bom == null ? 0 : bom.length);
    ConvertResult result = convertBytes(bytes, BOMEndOffset, length, internalCharset);
    if (saveDetectedSeparators) {
      String separator = result.majorLineSeparator();
      // when in doubt, leave old separator
      if (separator != null) {
        virtualFile.setDetectedLineSeparator(separator);
      }
    }
    return result;
  }
private static @NotNull ConvertResult convertBytesAndSetSeparator(byte @NotNull [] bytes,
                                                                    int length,
                                                                    @NotNull VirtualFile virtualFile,
                                                                    boolean saveDetectedSeparators,
                                                                    @NotNull DetectResult info,
                                                                    @NotNull Charset internalCharset)