Java源码示例:org.nutz.lang.Files

示例1
public void generate(String packageName, String templatePath, File file, boolean force)
        throws IOException {
    if (file.exists() && !force) {
        log.debug("file " + file + " exists, skipped");
        return;
    }

    String code = generateCode(packageName, templatePath);
    file.getParentFile().mkdirs();
    Files.write(file, code.getBytes(Charset.forName("utf8")));

}
 
示例2
public void generate(String packageName, String templatePath, File file, boolean force)
        throws IOException {
    if (file.exists() && !force) {
        log.debug("file " + file + " exists, skipped");
        return;
    }

    String code = generateCode(packageName, templatePath);
    file.getParentFile().mkdirs();
    Files.write(file, code.getBytes(Charset.forName("utf8")));

}