public static void writeDocument(@NotNull Document document, @NotNull String filePath, String lineSeparator) throws IOException {
    try (OutputStream stream = new BufferedOutputStream(new FileOutputStream(filePath))) {
      writeDocument(document, stream, lineSeparator);
    }
  }
public static void writeDocument(@NotNull Document document, @NotNull String filePath, String lineSeparator)