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

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

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

FileUtil.isNewer介绍

[英]Tests if the specified File is newer than the specified time reference.
[中]测试指定的File是否比指定的时间引用新。

代码示例

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

/**
 * Test if specified <code>File</code> is newer than the reference <code>File</code>.
 *
 * @param file        the <code>File</code> of which the modification date must be compared
 * @param reference    the <code>File</code> of which the modification date is used
 * @return <code>true</code> if the <code>File</code> exists and has been modified more
 *             recently than the reference <code>File</code>.
 */
public static boolean isNewer(File file, File reference) {
  if (!reference.exists()) {
    throw new IllegalArgumentException("Reference file not found: " + reference);
  }
  return isNewer(file, reference.lastModified());
}

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

public static boolean isNewer(String file, long timeMillis) {
  return isNewer(file(file), timeMillis);
}

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

/**
 * Uses {@link File#lastModified()} for reference.
 *
 * @see #isNewer(File, long)
 */
public static boolean isNewer(final File file, final File reference) {
  checkReferenceExists(reference);
  return isNewer(file, reference.lastModified());
}

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

/**
 * @see #isNewer(File, long)
 */
public static boolean isNewer(final String file, final long timeMillis) {
  return isNewer(file(file), timeMillis);
}

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

public static boolean isNewer(String file, String reference) {
  return isNewer(file(file), file(reference));
}

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

/**
 * @see #isNewer(File, File)
 */
public static boolean isNewer(final String file, final String reference) {
  return isNewer(file(file), file(reference));
}

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

@Test
void testFileManipulation() throws IOException {
  FileUtil.copy(new File(dataRoot, "sb.data"), new File(dataRoot, "sb1.data"));
  assertFalse(FileUtil.isNewer(new File(dataRoot, "sb.data"), new File(dataRoot, "sb1.data")));
  assertFalse(FileUtil.isOlder(new File(dataRoot, "sb.data"), new File(dataRoot, "sb1.data")));
  FileUtil.delete(new File(dataRoot, "sb1.data"));
}

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

/**
 * @see #isNewer(File, long)
 */
public static boolean isNewer(final String file, final long timeMillis) {
  return isNewer(file(file), timeMillis);
}

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

/**
 * Uses {@link File#lastModified()} for reference.
 *
 * @see #isNewer(File, long)
 */
public static boolean isNewer(final File file, final File reference) {
  checkReferenceExists(reference);
  return isNewer(file, reference.lastModified());
}

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

/**
 * @see #isNewer(File, File)
 */
public static boolean isNewer(final String file, final String reference) {
  return isNewer(file(file), file(reference));
}

相关文章

微信公众号

最新文章

更多