jodd.io.FileUtil.checkCreateDirectory()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(3.1k)|赞(0)|评价(0)|浏览(115)

本文整理了Java中jodd.io.FileUtil.checkCreateDirectory()方法的一些代码示例,展示了FileUtil.checkCreateDirectory()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FileUtil.checkCreateDirectory()方法的具体详情如下:
包路径:jodd.io.FileUtil
类名称:FileUtil
方法名:checkCreateDirectory

FileUtil.checkCreateDirectory介绍

[英]Checks if directory can be created. Throws IOException if it cannot.

This actually creates directory (and its ancestors) (as per File#mkdirs() }).
[中]检查是否可以创建目录。如果不能,则抛出IOException。
这实际上创建了目录(及其祖先)(根据文件#mkdirs()})。

代码示例

代码示例来源:origin: oblac/jodd

/**
 * Creates all directories at once.
 *
 * @param dirs Directories to make.
 * @throws IOException if cannot create directory.
 */
public static File mkdirs(final File dirs) throws IOException {
  if (dirs.exists()) {
    checkIsDirectory(dirs);
    return dirs;
  }
  return checkCreateDirectory(dirs);
}

代码示例来源:origin: oblac/jodd

/**
 * Creates single directory.
 *
 * @throws IOException if cannot create directory.
 */
public static File mkdir(final File dir) throws IOException {
  if (dir.exists()) {
    checkIsDirectory(dir);
    return dir;
  }
  return checkCreateDirectory(dir);
}

代码示例来源:origin: oblac/jodd

/**
 * Checks that file copy can occur.
 *
 * @param srcFile  Source {@link File}
 * @param destFile Destination {@link File}
 * @throws IOException if srcFile does not exist or is not a file or
 *                     srcFile and destFile are equal or cannot create ancestor directories.
 */
private static void checkFileCopy(final File srcFile, final File destFile) throws IOException {
  checkExists(srcFile);
  checkIsFile(srcFile);
  if (equals(srcFile, destFile)) {
    throw new IOException("Files '" + srcFile + "' and '" + destFile + "' are equal");
  }
  File destParent = destFile.getParentFile();
  if (destParent != null && !destParent.exists()) {
    checkCreateDirectory(destParent);
  }
}

代码示例来源:origin: oblac/jodd

checkIsDirectory(destDir);
} else {
  checkCreateDirectory(destDir);
  destDir.setLastModified(srcDir.lastModified());

代码示例来源:origin: org.jodd/jodd-core

/**
 * Creates single directory.
 *
 * @throws IOException if cannot create directory.
 */
public static File mkdir(final File dir) throws IOException {
  if (dir.exists()) {
    checkIsDirectory(dir);
    return dir;
  }
  return checkCreateDirectory(dir);
}

代码示例来源:origin: org.jodd/jodd-core

/**
 * Creates all directories at once.
 *
 * @param dirs Directories to make.
 * @throws IOException if cannot create directory.
 */
public static File mkdirs(final File dirs) throws IOException {
  if (dirs.exists()) {
    checkIsDirectory(dirs);
    return dirs;
  }
  return checkCreateDirectory(dirs);
}

代码示例来源:origin: org.jodd/jodd-core

/**
 * Checks that file copy can occur.
 *
 * @param srcFile  Source {@link File}
 * @param destFile Destination {@link File}
 * @throws IOException if srcFile does not exist or is not a file or
 *                     srcFile and destFile are equal or cannot create ancestor directories.
 */
private static void checkFileCopy(final File srcFile, final File destFile) throws IOException {
  checkExists(srcFile);
  checkIsFile(srcFile);
  if (equals(srcFile, destFile)) {
    throw new IOException("Files '" + srcFile + "' and '" + destFile + "' are equal");
  }
  File destParent = destFile.getParentFile();
  if (destParent != null && !destParent.exists()) {
    checkCreateDirectory(destParent);
  }
}

代码示例来源:origin: org.jodd/jodd-core

checkIsDirectory(destDir);
} else {
  checkCreateDirectory(destDir);
  destDir.setLastModified(srcDir.lastModified());

相关文章