public final class FileTime extends Object implements Comparable<FileTime>
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(FileTime other)
比较两
FileTime对象的秩序价值。
|
boolean |
equals(Object obj)
这
FileTime试验与给定对象的平等。
|
static FileTime |
from(Instant instant)
返回一个
FileTime代表同一时间点的价值在时间线提供的
Instant对象。
|
static FileTime |
from(long value, TimeUnit unit)
返回一个
FileTime代表一个值在给定的粒度单位。
|
static FileTime |
fromMillis(long value)
返回一个
FileTime表示给定值以毫秒为单位。
|
int |
hashCode()
计算此文件时间的哈希代码。
|
long |
to(TimeUnit unit)
返回给定粒度单位的值。
|
Instant |
toInstant()
将这一
Instant
FileTime对象。
|
long |
toMillis()
以毫秒为单位返回值。
|
String |
toString()
这
FileTime返回的字符串表示形式。
|
public static FileTime from(long value, TimeUnit unit)
FileTime代表一个值在给定的粒度单位。
value价值-由于时代(1970-01-01t00:00:00z);可以是负的
unit -粒度单位解释价值
FileTime表示给定值
public static FileTime fromMillis(long value)
FileTime表示给定值以毫秒为单位。
value的值,以毫秒为单位,由于时代(1970-01-01t00:00:00z);可以是负的
FileTime表示给定值
public static FileTime from(Instant instant)
FileTime代表同一时间点的价值在时间线提供的
Instant对象。
instant -转换的瞬间
FileTime代表时间轴上的同一点作为提供即时
public long to(TimeUnit unit)
从一个较粗的粒度,将数值溢出饱和Long.MIN_VALUE如果负或Long.MAX_VALUE如果积极转换。
unit -粒度单位为返回值
public long toMillis()
从一个较粗的粒度,将数值溢出饱和Long.MIN_VALUE如果负或Long.MAX_VALUE如果积极转换。
public Instant toInstant()
Instant
FileTime对象。
转换创建一个Instant代表时间轴上的同一点为这FileTime。
FileTime可以存储点的时间线进一步在未来比过去的Instant。从进一步的时间点转换饱和Instant.MIN如果早于或晚于Instant.MAX Instant.MIN Instant.MAX如果。
FileTime对象
public boolean equals(Object obj)
FileTime试验与给定对象的平等。
其结果是true如果只有参数不null是FileTime表示同一时间。该方法满足了Object.equals方法一般合同。
equals 方法重写,继承类
Object
obj -比较对象
true如果,仅仅是如果,在给定的对象是一个
FileTime表示同一时间
Object.hashCode(),
HashMap
public int hashCode()
散列码是基于价值的代表,和满足的Object.hashCode()方法一般合同。
hashCode 方法重写,继承类
Object
Object.equals(java.lang.Object),
System.identityHashCode(java.lang.Object)
public int compareTo(FileTime other)
FileTime对象的秩序价值。
compareTo 接口
Comparable<FileTime>
other -相比较其他
FileTime
0
FileTime等于
other,小于0的值如果
FileTime代表一个时间,在
other,和大于0的值,如果这个
FileTime代表一个时间,在
other
public String toString()
FileTime返回的字符串表示形式。字符串在
ISO 8601格式返回:
yyyy mm ddthh:MM:SS [的] Z。“
[.s+]”代表一个点的是一个更为二位数小数。只有当第二个小数部分不为零的时候才存在。例如,
FileTime.fromMillis(1234567890000L).toString()产量
"2009-02-13T23:31:30Z",和
FileTime.fromMillis(1234567890123L).toString()
"2009-02-13T23:31:30.123Z"
一个FileTime主要是为了代表一个文件的时间戳的值。在用来表示极端值,其中年小于“0001”或大于“9999”那么这种方法偏离了ISO 8601中相同的方式作为XML Schema language,今年可能会扩大到超过四位数,可能负符号。如果超过四个数字,则前导零是不存在的。在“0001”是“-0001年”。
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.