private void saveTemplate(@NotNull FileTemplate template, @NotNull String lineSeparator) {
    String fileName = encodeFileName(template.getName(), template.getExtension());
    String content = template.getText();
    if (!lineSeparator.equals("\n")) {
      content = StringUtilRt.convertLineSeparators(content, lineSeparator);
    }
    if (streamProvider.getEnabled()) {
      streamProvider.write(getSpec(fileName), content.getBytes(StandardCharsets.UTF_8), RoamingType.DEFAULT);
    }
    else {
      final Path templateFile = templateDir.resolve(fileName);
      try (OutputStream fileOutputStream = startWriteOrCreate(templateFile);
           OutputStreamWriter outputStreamWriter = new OutputStreamWriter(fileOutputStream, StandardCharsets.UTF_8)) {
        outputStreamWriter.write(content);
      }
      catch (IOException e) {
        LOG.error(e);
      }
    }
  }
private void saveTemplate(@NotNull FileTemplate template, @NotNull String lineSeparator)