Java Code Examples for java.nio.file.attribute.FileTime#equals()
The following examples show how to use
java.nio.file.attribute.FileTime#equals() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FilesChangedTracker.java From lemminx with Eclipse Public License 2.0 | 6 votes |
public boolean isDirty() { try { if (!Files.exists(file)) { // This case occurs when user delete the XML Schema / DTD file return true; } FileTime currentLastModified = Files.getLastModifiedTime(file); if (!currentLastModified.equals(lastModified)) { lastModified = currentLastModified; return true; } } catch (IOException e) { LOGGER.log(Level.SEVERE, "Get last modified time failed", e); return true; } return false; }
Example 2
Source File: Basic.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
static void eq(long v1, TimeUnit u1, long v2, TimeUnit u2) { FileTime t1 = FileTime.from(v1, u1); FileTime t2 = FileTime.from(v2, u2); if (!t1.equals(t2)) throw new RuntimeException("not equal"); if (t1.hashCode() != t2.hashCode()) throw new RuntimeException("hashCodes should be equal"); }
Example 3
Source File: Basic.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
static void eq(Instant ins, long v2, TimeUnit u2) { FileTime t1 = FileTime.from(ins); FileTime t2 = FileTime.from(v2, u2); if (!t1.equals(t2)) throw new RuntimeException("not equal"); if (t1.hashCode() != t2.hashCode()) throw new RuntimeException("hashCodes should be equal"); }
Example 4
Source File: Basic.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
static void eq(long v1, TimeUnit u1, long v2, TimeUnit u2) { FileTime t1 = FileTime.from(v1, u1); FileTime t2 = FileTime.from(v2, u2); if (!t1.equals(t2)) throw new RuntimeException("not equal"); if (t1.hashCode() != t2.hashCode()) throw new RuntimeException("hashCodes should be equal"); }
Example 5
Source File: Basic.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
static void eq(Instant ins, long v2, TimeUnit u2) { FileTime t1 = FileTime.from(ins); FileTime t2 = FileTime.from(v2, u2); if (!t1.equals(t2)) throw new RuntimeException("not equal"); if (t1.hashCode() != t2.hashCode()) throw new RuntimeException("hashCodes should be equal"); }
Example 6
Source File: Basic.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
static void eq(Instant ins, long v2, TimeUnit u2) { FileTime t1 = FileTime.from(ins); FileTime t2 = FileTime.from(v2, u2); if (!t1.equals(t2)) throw new RuntimeException("not equal"); if (t1.hashCode() != t2.hashCode()) throw new RuntimeException("hashCodes should be equal"); }
Example 7
Source File: Basic.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
static void eq(long v1, TimeUnit u1, long v2, TimeUnit u2) { FileTime t1 = FileTime.from(v1, u1); FileTime t2 = FileTime.from(v2, u2); if (!t1.equals(t2)) throw new RuntimeException("not equal"); if (t1.hashCode() != t2.hashCode()) throw new RuntimeException("hashCodes should be equal"); }
Example 8
Source File: MavenProjectSupplierTest.java From helidon-build-tools with Apache License 2.0 | 5 votes |
@Test void testChangedSinceTwoFilesChanged() { FileTime initialPom = lastModified(pomFile); FileTime touchedPom = touchFile(pomFile); assertThat(touchedPom.compareTo(initialPom), is(greaterThan(0))); FileTime initialJava = lastModified(javaFile); FileTime touchedJava = touchFile(javaFile); assertThat(touchedJava.compareTo(initialJava), is(greaterThan(0))); assertThat(touchedJava, is(not(touchedPom))); assertThat(touchedJava.compareTo(touchedPom), is(greaterThan(0))); // Check LATEST should find touchedJava since it was most recent FileTime found = changedTime(initialPom, LATEST); assertThat(found, is(touchedJava)); // Check FIRST should find touchedPom since it was changed first, but this is // file system iteration order dependent so just make sure it is one of them found = changedTime(initialPom, FIRST); if (!found.equals(touchedPom) && !found.equals(touchedJava)) { fail("Expected either " + touchedPom + " or " + touchedJava + ", got " + found); } }
Example 9
Source File: Basic.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
static void eq(Instant ins, long v2, TimeUnit u2) { FileTime t1 = FileTime.from(ins); FileTime t2 = FileTime.from(v2, u2); if (!t1.equals(t2)) throw new RuntimeException("not equal"); if (t1.hashCode() != t2.hashCode()) throw new RuntimeException("hashCodes should be equal"); }
Example 10
Source File: Basic.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
static void eq(long v1, TimeUnit u1, long v2, TimeUnit u2) { FileTime t1 = FileTime.from(v1, u1); FileTime t2 = FileTime.from(v2, u2); if (!t1.equals(t2)) throw new RuntimeException("not equal"); if (t1.hashCode() != t2.hashCode()) throw new RuntimeException("hashCodes should be equal"); }
Example 11
Source File: Basic.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
static void eq(long v1, TimeUnit u1, long v2, TimeUnit u2) { FileTime t1 = FileTime.from(v1, u1); FileTime t2 = FileTime.from(v2, u2); if (!t1.equals(t2)) throw new RuntimeException("not equal"); if (t1.hashCode() != t2.hashCode()) throw new RuntimeException("hashCodes should be equal"); }
Example 12
Source File: Basic.java From hottub with GNU General Public License v2.0 | 5 votes |
static void eq(long v1, TimeUnit u1, long v2, TimeUnit u2) { FileTime t1 = FileTime.from(v1, u1); FileTime t2 = FileTime.from(v2, u2); if (!t1.equals(t2)) throw new RuntimeException("not equal"); if (t1.hashCode() != t2.hashCode()) throw new RuntimeException("hashCodes should be equal"); }
Example 13
Source File: Basic.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
static void neq(long v1, TimeUnit u1, long v2, TimeUnit u2) { FileTime t1 = FileTime.from(v1, u1); FileTime t2 = FileTime.from(v2, u2); if (t1.equals(t2)) throw new RuntimeException("should not be equal"); }
Example 14
Source File: Basic.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
static void neq(long v1, TimeUnit u1, long v2, TimeUnit u2) { FileTime t1 = FileTime.from(v1, u1); FileTime t2 = FileTime.from(v2, u2); if (t1.equals(t2)) throw new RuntimeException("should not be equal"); }
Example 15
Source File: Basic.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
static void neq(long v1, TimeUnit u1, long v2, TimeUnit u2) { FileTime t1 = FileTime.from(v1, u1); FileTime t2 = FileTime.from(v2, u2); if (t1.equals(t2)) throw new RuntimeException("should not be equal"); }
Example 16
Source File: Basic.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
static void neq(long v1, TimeUnit u1, long v2, TimeUnit u2) { FileTime t1 = FileTime.from(v1, u1); FileTime t2 = FileTime.from(v2, u2); if (t1.equals(t2)) throw new RuntimeException("should not be equal"); }
Example 17
Source File: Basic.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 4 votes |
static void neq(long v1, TimeUnit u1, long v2, TimeUnit u2) { FileTime t1 = FileTime.from(v1, u1); FileTime t2 = FileTime.from(v2, u2); if (t1.equals(t2)) throw new RuntimeException("should not be equal"); }
Example 18
Source File: Basic.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
static void neq(Instant ins, long v2, TimeUnit u2) { FileTime t1 = FileTime.from(ins); FileTime t2 = FileTime.from(v2, u2); if (t1.equals(t2)) throw new RuntimeException("should not be equal"); }
Example 19
Source File: Basic.java From dragonwell8_jdk with GNU General Public License v2.0 | 4 votes |
static void neq(Instant ins, long v2, TimeUnit u2) { FileTime t1 = FileTime.from(ins); FileTime t2 = FileTime.from(v2, u2); if (t1.equals(t2)) throw new RuntimeException("should not be equal"); }
Example 20
Source File: Basic.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
static void neq(Instant ins, long v2, TimeUnit u2) { FileTime t1 = FileTime.from(ins); FileTime t2 = FileTime.from(v2, u2); if (t1.equals(t2)) throw new RuntimeException("should not be equal"); }