本文整理了Java中jodd.io.FileUtil.file()
方法的一些代码示例,展示了FileUtil.file()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FileUtil.file()
方法的具体详情如下:
包路径:jodd.io.FileUtil
类名称:FileUtil
方法名:file
[英]Simple factory for File
objects.
[中]File
对象的简单工厂。
代码示例来源:origin: redisson/redisson
/**
* @see #copyFile(java.io.File, java.io.File, FileUtilParams)
*/
public static void copyFile(String src, String dest, FileUtilParams params) throws IOException {
copyFile(file(src), file(dest), params);
}
/**
代码示例来源:origin: redisson/redisson
/**
* Checks if two files points to the same file.
*/
public static boolean equals(String file1, String file2) {
return equals(file(file1), file(file2));
}
代码示例来源:origin: redisson/redisson
/**
* @see #copyFile(java.io.File, java.io.File, FileUtilParams)
*/
public static void copyFile(String src, String dest) throws IOException {
copyFile(file(src), file(dest), fileUtilParams);
}
/**
代码示例来源:origin: redisson/redisson
/**
* @see #copyFileToDir(java.io.File, java.io.File, FileUtilParams)
*/
public static File copyFileToDir(String src, String destDir, FileUtilParams params) throws IOException {
return copyFileToDir(file(src), file(destDir), params);
}
/**
代码示例来源:origin: redisson/redisson
/**
* @see #copyFileToDir(java.io.File, java.io.File, FileUtilParams)
*/
public static File copyFileToDir(String src, String destDir) throws IOException {
return copyFileToDir(file(src), file(destDir), fileUtilParams);
}
/**
代码示例来源:origin: redisson/redisson
public static File moveDir(String srcDir, String destDir) throws IOException {
return moveDir(file(srcDir), file(destDir));
}
public static File moveDir(File srcDir, File destDir) throws IOException {
代码示例来源:origin: redisson/redisson
public static boolean isNewer(String file, String reference) {
return isNewer(file(file), file(reference));
}
代码示例来源:origin: redisson/redisson
/**
* Converts file URLs to file. Ignores other schemes and returns <code>null</code>.
*/
public static File toFile(URL url) {
String fileName = toFileName(url);
if (fileName == null) {
return null;
}
return file(fileName);
}
代码示例来源:origin: redisson/redisson
public static File moveFileToDir(File src, File destDir, FileUtilParams params) throws IOException {
if (destDir.exists() && !destDir.isDirectory()) {
throw new IOException(MSG_NOT_A_DIRECTORY + destDir);
}
return moveFile(src, file(destDir, src.getName()), params);
}
代码示例来源:origin: redisson/redisson
/**
* Creates single folder.
* @see #mkdir(java.io.File)
*/
public static void mkdir(String dir) throws IOException {
mkdir(file(dir));
}
/**
代码示例来源:origin: redisson/redisson
/**
* @see #touch(java.io.File)
*/
public static void touch(String file) throws IOException {
touch(file(file));
}
/**
代码示例来源:origin: redisson/redisson
/**
* Creates all folders at once.
* @see #mkdirs(java.io.File)
*/
public static void mkdirs(String dirs) throws IOException {
mkdirs(file(dirs));
}
/**
代码示例来源:origin: redisson/redisson
/**
* Copies a file to folder with specified copy params and returns copied destination.
*/
public static File copyFileToDir(File src, File destDir, FileUtilParams params) throws IOException {
if (destDir.exists() && !destDir.isDirectory()) {
throw new IOException(MSG_NOT_A_DIRECTORY + destDir);
}
File dest = file(destDir, src.getName());
copyFile(src, dest, params);
return dest;
}
代码示例来源:origin: redisson/redisson
public static void deleteDir(String dest) throws IOException {
deleteDir(file(dest), fileUtilParams);
}
public static void deleteDir(String dest, FileUtilParams params) throws IOException {
代码示例来源:origin: redisson/redisson
public static void cleanDir(String dest) throws IOException {
cleanDir(file(dest), fileUtilParams);
}
public static void cleanDir(String dest, FileUtilParams params) throws IOException {
代码示例来源:origin: redisson/redisson
public static void cleanDir(String dest, FileUtilParams params) throws IOException {
cleanDir(file(dest), params);
}
public static void cleanDir(File dest) throws IOException {
代码示例来源:origin: redisson/redisson
public static String[] readLines(String source) throws IOException {
return readLines(file(source), fileUtilParams.encoding);
}
public static String[] readLines(String source, String encoding) throws IOException {
代码示例来源:origin: redisson/redisson
public static void writeChars(String dest, char[] data, String encoding) throws IOException {
outChars(file(dest), data, encoding, false);
}
代码示例来源:origin: redisson/redisson
public static void appendString(String dest, String data, String encoding) throws IOException {
outString(file(dest), data, encoding, true);
}
代码示例来源:origin: redisson/redisson
private static void doMoveDirectory(File src, File dest) throws IOException {
if (dest.exists()) {
if (!dest.isDirectory()) {
throw new IOException(MSG_NOT_A_DIRECTORY + dest);
}
dest = file(dest, dest.getName());
dest.mkdir();
}
final boolean rename = src.renameTo(dest);
if (!rename) {
doCopyDirectory(src, dest, params());
deleteDir(src);
}
}
内容来源于网络,如有侵权,请联系作者删除!