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

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

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

FileUtil.isExistingFile介绍

[英]Returns true if file exists.
[中]如果文件存在,则返回true

代码示例

代码示例来源:origin: redisson/redisson

protected ZipBuilder(File zipFile) throws IOException {
  if (!FileUtil.isExistingFile(zipFile)) {
    FileUtil.touch(zipFile);
  }
  zos = new ZipOutputStream(new FileOutputStream(zipFile));
  targetZipFile = zipFile;
  targetBaos = null;
}

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

protected ZipBuilder(final File zipFile) throws IOException {
  if (!FileUtil.isExistingFile(zipFile)) {
    FileUtil.touch(zipFile);
  }
  zos = new ZipOutputStream(new FileOutputStream(zipFile));
  targetZipFile = zipFile;
  targetBaos = null;
}

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

@Test
void file_exists() throws Exception {
  final File input = new File(FileUtilTest.class.getResource("data/file/a.txt").toURI());
  final boolean actual = FileUtil.isExistingFile(input);
  // asserts
  assertEquals(true, actual);
}

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

@Test
  void file_is_null() throws Exception {
    final boolean actual = FileUtil.isExistingFile(null);
    // asserts
    assertEquals(false, actual);
  }
}

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

@Test
void file_not_exists() throws Exception {
  final File input = FileUtil.createTempFile("hello", ".jodd", new File(SystemUtil.info().getTempDir()), false);
  final boolean actual = FileUtil.isExistingFile(input);
  // asserts
  assertEquals(false, actual);
}

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

protected ZipBuilder(final File zipFile) throws IOException {
  if (!FileUtil.isExistingFile(zipFile)) {
    FileUtil.touch(zipFile);
  }
  zos = new ZipOutputStream(new FileOutputStream(zipFile));
  targetZipFile = zipFile;
  targetBaos = null;
}

代码示例来源:origin: com.liferay.launchpad/common

@Override
public String loadConfigContent() {
  if (file == null) {
    return null;
  }
  log.debug("Trying config file: {}", file);
  if (!FileUtil.isExistingFile(file)) {
    return null;
  }
  try {
    return FileUtil.readString(file);
  }
  catch (IOException ioex) {
    return null;
  }
}

代码示例来源:origin: com.liferay.launchpad/common

public LaunchpadBaseStructure(String root) {
  this.launchpadJson = new File(root, LAUNCHPAD_JSON);
  if (!FileUtil.isExistingFile(launchpadJson)) {
    throw new LaunchpadStructureException(
        "Invalid file: " + launchpadJson);
  }
  load();
}

相关文章