|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.nio.file.attribute.FileTime
public final class FileTime
Disabled: no SafeJ information.
Represents the value of a file's time stamp attribute. For example, it may represent the time that the file was last modified, accessed, or created.
Instances of this class are immutable.
BasicFileAttributes,
Attributes.setLastModifiedTime(java.nio.file.FileRef, java.nio.file.attribute.FileTime)| Method Summary | |
|---|---|
int |
compareTo(FileTime other)
Compares the value of two FileTime objects for order. |
boolean |
equals(Object obj)
Tests this FileTime for equality with the given object. |
static FileTime |
from(long value,
TimeUnit unit)
Returns a FileTime representing a value at the given unit of
granularity. |
static FileTime |
fromMillis(long value)
Returns a FileTime representing the given value in milliseconds. |
int |
hashCode()
Computes a hash code for this file time. |
long |
to(TimeUnit unit)
Returns the value at the given unit of granularity. |
long |
toMillis()
Returns the value in milliseconds. |
String |
toString()
Returns the string representation of this FileTime. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Method Detail |
|---|
public static FileTime from(long value,
TimeUnit unit)
FileTime representing a value at the given unit of
granularity.
value - the value since the epoch (1970-01-01T00:00:00Z); can be
negativeunit - the unit of granularity to interpret the value
FileTime representing the given valuepublic static FileTime fromMillis(long value)
FileTime representing the given value in milliseconds.
value - the value, in milliseconds, since the epoch
(1970-01-01T00:00:00Z); can be negative
FileTime representing the given valuepublic long to(TimeUnit unit)
Conversion from a coarser granularity that would numerically overflow
saturate to Long.MIN_VALUE if negative or Long.MAX_VALUE
if positive.
unit - the unit of granularity for the return value
public long toMillis()
Conversion from a coarser granularity that would numerically overflow
saturate to Long.MIN_VALUE if negative or Long.MAX_VALUE
if positive.
public boolean equals(Object obj)
FileTime for equality with the given object.
The result is true if and only if the argument is not null and is a FileTime that represents the same time. This
method satisfies the general contract of the Object.equals method.
equals in class Objectobj - the object to compare with
true if, and only if, the given object is a FileTime that represents the same timeObject.hashCode(),
HashMappublic int hashCode()
The hash code is based upon the value represented, and satisfies the
general contract of the Object.hashCode() method.
hashCode in class ObjectObject.equals(java.lang.Object),
System.identityHashCode(java.lang.Object)public int compareTo(FileTime other)
FileTime objects for order.
compareTo in interface Comparable<FileTime>other - the other FileTime to be compared
0 if this FileTime is equal to other, a
value less than 0 if this FileTime represents a time
that is before other, and a value greater than 0 if this
FileTime represents a time that is after otherpublic String toString()
FileTime. The string
is returned in the ISO 8601 format:
YYYY-MM-DDThh:mm:ss[.s+]Z
where "[.s+]" represents a dot followed by one of more digits
for the decimal fraction of a second. It is only present when the decimal
fraction of a second is not zero. For example, FileTime.fromMillis(1234567890000L).toString() yields "2009-02-13T23:31:30Z", and FileTime.fromMillis(1234567890123L).toString()
yields "2009-02-13T23:31:30.123Z".
A FileTime is primarly intended to represent the value of a
file's time stamp. Where used to represent extreme values, where
the year is less than "0001" or greater than "9999" then
the year may be expanded to more than four digits and may be
negative-signed. If more than four digits then leading zeros are not
present. The year before "0001" is "-0001".
toString in class Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||