Code example for FileWriter

Methods: close

0
        File dir = fullPath.getParentFile();
        String filename = fullPath.getName();
        File convertedFile = new File(dir, filename + ".canonical");
        config.setDirectoryForTemplateLoading(dir);
        Template template = config.getTemplate(filename);
        FileWriter output = new FileWriter(convertedFile);
        try { 
            template.dump(output);
        } finally { 
            output.close();
        } 
    } 
 
    static void usage() { 
        System.err.println("Usage: java freemarker.template.utility.ToCanonical <filename(s)>");
    } 
}