本文整理汇总了Java中jodd.io.FileUtil.mkdirs方法的典型用法代码示例。如果您正苦于以下问题:Java FileUtil.mkdirs方法的具体用法?Java FileUtil.mkdirs怎么用?Java FileUtil.mkdirs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jodd.io.FileUtil
的用法示例。
在下文中一共展示了FileUtil.mkdirs方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: mklink
import jodd.io.FileUtil; //导入方法依赖的package包/类
public static void mklink(String target, String source) throws Exception {
File fTarget = new File(polishFilePath(target));
if (fTarget.exists() && fTarget.isDirectory()) {
if (isSymbolicLink(target)) {
exec("rd /q " + fTarget.getAbsolutePath(), ".", true, true);
} else {
FileUtil.deleteDir(fTarget);
}
}
if (!fTarget.getParentFile().exists()) {
FileUtil.mkdirs(fTarget.getParentFile());
}
File fSource = new File(polishFilePath(source));
if (fSource.isDirectory()) {
exec("mklink /d " + target + " " + source, ".", true, true);
} else {
exec("mklink /h " + target + " " + source, ".", true, true);
}
}
示例2: writeJavaFile
import jodd.io.FileUtil; //导入方法依赖的package包/类
public void writeJavaFile() {
try {
String pkg2 = pkg + ".actions";
StringBuilder javaCodes = new StringBuilder();
javaCodes.append("package " + pkg2 + ";\n\n");
javaCodes.append("import okhttp3.HttpUrl;\n" +
"import org.datasays.wes.core.RequestInfo;\n" +
"import org.datasays.wes.types.*;\n");
javaCodes.append(codes.toString());
javaCodes.append("}\n");
String filePath = sourceDir + pkg2.replace('.', File.separatorChar) + File.separatorChar;
FileUtil.mkdirs(filePath);
FileUtil.writeString(filePath + clsName + ".java", javaCodes.toString(), "utf-8");
codes = new StringBuilder();
} catch (IOException e) {
e.printStackTrace();
}
}
示例3: backupData
import jodd.io.FileUtil; //导入方法依赖的package包/类
/**
* 备份es数据到backupDir目录
*
* @param index
* @param type
* @param backupDir
*/
@SuppressWarnings("unchecked")
public void backupData(String index, String type, String backupDir) {
try {
String path = path(backupDir, index, type);
FileUtil.mkdirs(path);
WPageIterator<Object> result = search(index, type, SearchQuery.MatchAll(), Object.class);
while (result.hasNext()) {
Object vo = result.next();
WJsonUtils.writeJson(path + ((Map<Object, Object>) vo).get("id") + ".json", vo);
}
} catch (IOException e) {
LOG.error(e.getMessage(), e);
}
}
示例4: writeEnumType
import jodd.io.FileUtil; //导入方法依赖的package包/类
public void writeEnumType(String type, List<String> options, String defaultValue, String description) {
try {
String pkg2 = pkg + ".types";
StringBuilder javaCodes = new StringBuilder();
javaCodes.append("package " + pkg2 + ";\n\n");
javaCodes.append("//" + description + "\n");
javaCodes.append("//default: " + defaultValue + "\n");
javaCodes.append("public enum " + type + " {\n");
String enumCodes = "";
for (String option : options) {
String enumName = option.toUpperCase();
if (option.trim().length() <= 0) {
enumName = "v";
}
enumCodes += "\t" + enumName + "(\"" + option + "\"),\n";
}
enumCodes = StringUtil.cutSuffix(enumCodes, ",\n");
javaCodes.append(enumCodes + ";\n");
javaCodes.append("\tprivate String name;\n");
javaCodes.append("\t" + type + "(String name) {\n");
javaCodes.append("\t\tthis.name = name;\n");
javaCodes.append("\t}\n\n");
javaCodes.append("\[email protected]\n");
javaCodes.append("\tpublic String toString() {\n");
javaCodes.append("\treturn this.name;\n");
javaCodes.append("\t}\n");
javaCodes.append("}");
String filePath = sourceDir + pkg2.replace('.', File.separatorChar) + File.separatorChar;
FileUtil.mkdirs(filePath);
FileUtil.writeString(filePath + type + ".java", javaCodes.toString(), "utf-8");
} catch (IOException e) {
e.printStackTrace();
}
}
示例5: writeEsHelper
import jodd.io.FileUtil; //导入方法依赖的package包/类
public void writeEsHelper() {
try {
String pkg2 = pkg + ".client";
StringBuilder javaCodes = new StringBuilder();
javaCodes.append("package " + pkg2 + ";\n\n");
javaCodes.append("import okhttp3.HttpUrl;\n");
javaCodes.append("import okhttp3.OkHttpClient;\n");
javaCodes.append("import org.datasays.wes.actions.*;\n");
javaCodes.append("import org.datasays.wes.core.IConvert;\n");
javaCodes.append("import org.datasays.wes.core.WHttpClient;\n\n");
javaCodes.append("public class EsHelper extends WHttpClient {\n");
javaCodes.append("\tprotected HttpUrl server;\n");
javaCodes.append("\n");
javaCodes.append("\tpublic EsHelper() {\n");
javaCodes.append("\t\tsuper();\n");
javaCodes.append("\t}\n\n");
javaCodes.append("\tpublic void init(String server, OkHttpClient client, IConvert convert) {\n");
javaCodes.append("\t\tif (server.trim().endsWith(\"/\")) {\n");
javaCodes.append("\t\t\tserver = server.trim().substring(0, server.trim().length() - 1);\n");
javaCodes.append("\t\t}\n");
javaCodes.append("\t\tthis.server = HttpUrl.parse(server);\n");
javaCodes.append("\t\tsuper.init(client, convert);\n");
javaCodes.append("\t}\n\n");
javaCodes.append(helperCodes.toString());
javaCodes.append("}\n");
String filePath = sourceDir + pkg2.replace('.', File.separatorChar) + File.separatorChar;
FileUtil.mkdirs(filePath);
FileUtil.writeString(filePath + "EsHelper.java", javaCodes.toString(), "utf-8");
} catch (IOException e) {
e.printStackTrace();
}
}