org.apache.commons.io.FileUtils.verifiedListFiles()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(3.6k)|赞(0)|评价(0)|浏览(166)

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

FileUtils.verifiedListFiles介绍

[英]Lists files in a directory, asserting that the supplied directory satisfies exists and is a directory
[中]列出目录中的文件,断言提供的目录满足exists并且是一个目录

代码示例

代码示例来源:origin: commons-io/commons-io

/**
 * Cleans a directory without deleting it.
 *
 * @param directory directory to clean
 * @throws IOException              in case cleaning is unsuccessful
 * @throws IllegalArgumentException if {@code directory} does not exist or is not a directory
 */
public static void cleanDirectory(final File directory) throws IOException {
  final File[] files = verifiedListFiles(directory);
  IOException exception = null;
  for (final File file : files) {
    try {
      forceDelete(file);
    } catch (final IOException ioe) {
      exception = ioe;
    }
  }
  if (null != exception) {
    throw exception;
  }
}

代码示例来源:origin: commons-io/commons-io

/**
 * Cleans a directory without deleting it.
 *
 * @param directory directory to clean, must not be {@code null}
 * @throws NullPointerException if the directory is {@code null}
 * @throws IOException          in case cleaning is unsuccessful
 */
private static void cleanDirectoryOnExit(final File directory) throws IOException {
  final File[] files = verifiedListFiles(directory);
  IOException exception = null;
  for (final File file : files) {
    try {
      forceDeleteOnExit(file);
    } catch (final IOException ioe) {
      exception = ioe;
    }
  }
  if (null != exception) {
    throw exception;
  }
}

代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded

/**
 * Cleans a directory without deleting it.
 *
 * @param directory directory to clean
 * @throws IOException              in case cleaning is unsuccessful
 * @throws IllegalArgumentException if {@code directory} does not exist or is not a directory
 */
public static void cleanDirectory(final File directory) throws IOException {
  final File[] files = verifiedListFiles(directory);
  IOException exception = null;
  for (final File file : files) {
    try {
      forceDelete(file);
    } catch (final IOException ioe) {
      exception = ioe;
    }
  }
  if (null != exception) {
    throw exception;
  }
}

代码示例来源:origin: io.github.stephenc.docker/docker-client-shaded

/**
 * Cleans a directory without deleting it.
 *
 * @param directory directory to clean
 * @throws IOException              in case cleaning is unsuccessful
 * @throws IllegalArgumentException if {@code directory} does not exist or is not a directory
 */
public static void cleanDirectory(final File directory) throws IOException {
  final File[] files = verifiedListFiles(directory);
  IOException exception = null;
  for (final File file : files) {
    try {
      forceDelete(file);
    } catch (final IOException ioe) {
      exception = ioe;
    }
  }
  if (null != exception) {
    throw exception;
  }
}

代码示例来源:origin: io.github.stephenc.docker/docker-client-shaded

/**
 * Cleans a directory without deleting it.
 *
 * @param directory directory to clean, must not be {@code null}
 * @throws NullPointerException if the directory is {@code null}
 * @throws IOException          in case cleaning is unsuccessful
 */
private static void cleanDirectoryOnExit(final File directory) throws IOException {
  final File[] files = verifiedListFiles(directory);
  IOException exception = null;
  for (final File file : files) {
    try {
      forceDeleteOnExit(file);
    } catch (final IOException ioe) {
      exception = ioe;
    }
  }
  if (null != exception) {
    throw exception;
  }
}

代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded

/**
 * Cleans a directory without deleting it.
 *
 * @param directory directory to clean, must not be {@code null}
 * @throws NullPointerException if the directory is {@code null}
 * @throws IOException          in case cleaning is unsuccessful
 */
private static void cleanDirectoryOnExit(final File directory) throws IOException {
  final File[] files = verifiedListFiles(directory);
  IOException exception = null;
  for (final File file : files) {
    try {
      forceDeleteOnExit(file);
    } catch (final IOException ioe) {
      exception = ioe;
    }
  }
  if (null != exception) {
    throw exception;
  }
}

相关文章

FileUtils类方法