false, size and modification time carry no meaning
-1 when the file did not exist
null when the file did not exist
The comparison is best-effort: a concurrent write within the file system's timestamp resolution that also keeps the size identical goes undetected.
| Modifier and Type | Field and Description |
|---|---|
| private static final FileSnapshot | |
| private final boolean | |
| private final @Nullable FileTime | lastModifiedTime
Record Component accessed by lastModifiedTime(). the modification time,null when the file did not exist
|
| private static final Logger | |
| private final long |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public final boolean | equals(Object o)
Implements abstract java. Indicates whether some other object is "equal to" this one. |
| public boolean | |
| public final int | |
| public @Nullable FileTime | lastModifiedTime()
Record Component getter of lastModifiedTime.
Record Component
the modification time, |
| public boolean | |
| public static @Nullable FileSnapshot | |
| public long | |
| public final String | toString()
Implements abstract java. Returns a string representation of the record. |
| ABSENT | back to summary |
|---|---|
| private static final FileSnapshot ABSENT | |
| exists | back to summary |
|---|---|
| private final boolean exists Record Component accessed by exists(). whether the file existed; when | |
| lastModifiedTime | back to summary |
|---|---|
| private final @Nullable FileTime lastModifiedTime Record Component accessed by lastModifiedTime(). the modification time, | |
| LOGGER | back to summary |
|---|---|
| private static final Logger LOGGER | |
| size | back to summary |
|---|---|
| private final long size Record Component accessed by size(). the file size in bytes, | |
| FileSnapshot | back to summary |
|---|---|
| public FileSnapshot(boolean exists, long size, @Nullable FileTime lastModifiedTime) | |
| equals | back to summary |
|---|---|
| public final boolean equals(Object o) Implements abstract java. Doc from java. Indicates whether some other object is "equal to" this one. In addition
to the general contract of
R copy = new R(r.c1(), r.c2(), ..., r.cn());
then it must be the case that r.equals(copy).
| |
| exists | back to summary |
|---|---|
| public boolean exists() Record Component getter of exists.
| |
| hashCode | back to summary |
|---|---|
| public final int hashCode() Implements abstract java. Doc from java. Returns a hash code value for the record.
Obeys the general contract of | |
| lastModifiedTime | back to summary |
|---|---|
| public @Nullable FileTime lastModifiedTime() Record Component getter of lastModifiedTime.
| |
| matches | back to summary |
|---|---|
| public boolean matches(Path file) Best-effort check whether the given file still is in the state captured by this snapshot. An unreadable current state counts as a mismatch. | |
| read | back to summary |
|---|---|
| public static @Nullable FileSnapshot read(Path file) Captures the current state of the given file. A missing file yields a snapshot with
| |
| size | back to summary |
|---|---|
| public long size() Record Component getter of size.
| |
| toString | back to summary |
|---|---|
| public final String toString() Implements abstract java. Doc from java. Returns a string representation of the record.
In accordance with the general contract of In addition to this general contract, record classes must further participate in the invariant that any two records which are equal must produce equal strings. This invariant is necessarily relaxed in the rare case where corresponding equal component values might fail to produce equal strings for themselves. | |