Serializable
, Instant
, StringBuilderFormattable
public class MutableInstant extends Object implements Instant, Serializable
Instances of this class are not thread-safe and should not be shared between threads.
Constructor | Description |
---|---|
MutableInstant() |
Modifier and Type | Method | Description |
---|---|---|
boolean |
equals(Object object) |
|
void |
formatTo(StringBuilder buffer) |
Writes a text representation of this object into the specified
StringBuilder , ideally without allocating
temporary objects. |
long |
getEpochMillisecond() |
Gets the number of milliseconds from the Java epoch of 1970-01-01T00:00:00Z.
|
long |
getEpochSecond() |
Gets the number of seconds from the Java epoch of 1970-01-01T00:00:00Z.
|
int |
getNanoOfMillisecond() |
Gets the number of nanoseconds, later along the time-line, from the start of the millisecond.
|
int |
getNanoOfSecond() |
Gets the number of nanoseconds, later along the time-line, from the start of the second.
|
int |
hashCode() |
|
void |
initFrom(Instant other) |
|
void |
initFrom(Clock clock) |
|
void |
initFromEpochMilli(long epochMilli,
int nanoOfMillisecond) |
Updates the fields of this
MutableInstant from the specified epoch millis. |
void |
initFromEpochSecond(long epochSecond,
int nano) |
Updates the fields of this
MutableInstant from the specified instant components. |
static void |
instantToMillisAndNanos(long epochSecond,
int nano,
long[] result) |
Updates the elements of the specified
long[] result array from the specified instant components. |
String |
toString() |
public long getEpochSecond()
Instant
The epoch second count is a simple incrementing count of seconds where second 0 is 1970-01-01T00:00:00Z.
The nanosecond part of the day is returned by Instant.getNanoOfSecond()
.
getEpochSecond
in interface Instant
public int getNanoOfSecond()
Instant
The nanosecond-of-second value measures the total number of nanoseconds from the second returned by Instant.getEpochSecond()
.
getNanoOfSecond
in interface Instant
999,999,999
public long getEpochMillisecond()
Instant
The epoch millisecond count is a simple incrementing count of milliseconds where millisecond 0 is 1970-01-01T00:00:00Z.
The nanosecond part of the day is returned by Instant.getNanoOfMillisecond()
.
getEpochMillisecond
in interface Instant
public int getNanoOfMillisecond()
Instant
The nanosecond-of-millisecond value measures the total number of nanoseconds from the millisecond returned by Instant.getEpochMillisecond()
.
getNanoOfMillisecond
in interface Instant
999,999
public void initFrom(Instant other)
public void initFromEpochMilli(long epochMilli, int nanoOfMillisecond)
MutableInstant
from the specified epoch millis.epochMilli
- the number of milliseconds from the Java epoch of 1970-01-01T00:00:00ZnanoOfMillisecond
- the number of nanoseconds, later along the time-line, from the start of the millisecondpublic void initFrom(Clock clock)
public void initFromEpochSecond(long epochSecond, int nano)
MutableInstant
from the specified instant components.epochSecond
- the number of seconds from the Java epoch of 1970-01-01T00:00:00Znano
- the number of nanoseconds, later along the time-line, from the start of the secondpublic static void instantToMillisAndNanos(long epochSecond, int nano, long[] result)
long[]
result array from the specified instant components.epochSecond
- (input) the number of seconds from the Java epoch of 1970-01-01T00:00:00Znano
- (input) the number of nanoseconds, later along the time-line, from the start of the secondresult
- (output) a two-element array to store the result: the first element is the number of milliseconds
from the Java epoch of 1970-01-01T00:00:00Z,
the second element is the number of nanoseconds, later along the time-line, from the start of the millisecondpublic void formatTo(StringBuilder buffer)
StringBuilderFormattable
StringBuilder
, ideally without allocating
temporary objects.formatTo
in interface StringBuilderFormattable
buffer
- the StringBuilder to write intoCopyright © 1999-2018. All Rights Reserved.
Apache Logging, Apache Log4j, Log4j, Apache, the Apache feather logo, the Apache Logging project logo, and the Apache Log4j logo are trademarks of The Apache Software Foundation.