OutputStreamWriter out = null;
File outFileTmp = new File(outFile.getAbsolutePath() + ".tmp");
FileUtils.forceDelete(outFileTmp);
try {
//bug fix for UTF8 BOM issue by TonyQ
in = new UnicodeReader(new FileInputStream(inFile), encoding);
if (!outFile.getParentFile().exists() && !outFile.getParentFile().mkdirs()) {
throw new MojoExecutionException("Cannot create resource output directory: " + outFile.getParentFile());
}
getLog().debug("use a temporary outputfile (in case in == out)");