Performs the transformation.
()
| 116 | * Performs the transformation. |
| 117 | */ |
| 118 | void transform() throws Exception { |
| 119 | String templateName = ftlFile.getName(); |
| 120 | Template template = cfg.getTemplate(templateName, locale); |
| 121 | NodeModel rootNode = NodeModel.parse(inputFile); |
| 122 | OutputStream outputStream = System.out; |
| 123 | if (outputFile != null) { |
| 124 | outputStream = new FileOutputStream(outputFile); |
| 125 | } |
| 126 | Writer outputWriter = new OutputStreamWriter(outputStream, encoding); |
| 127 | try { |
| 128 | template.process(null, outputWriter, null, rootNode); |
| 129 | } finally { |
| 130 | if (outputFile != null) |
| 131 | outputWriter.close(); |
| 132 | } |
| 133 | } |
| 134 | |
| 135 | static Transform transformFromArgs(String[] args) throws IOException { |
| 136 | int i=0; |