PrintWriter writer = null;
try {
writer = FileUtil.getPrintWriter(destPath, Velocity.getProperty(Velocity.OUTPUT_ENCODING).toString(), false);
template.merge(context, writer);
} catch (IOException e) {
throw new UtilException(StrUtil.format("Write Velocity content to [{}] error!", destPath), e);
}finally {
FileUtil.close(writer);
}
}