InstantAsLongSerializer


@RequiresApi(api = Build.VERSION_CODES.O)
public class InstantAsLongSerializer implements LongSerializer


Serializes a Instant to and from a long. The Instant is serialized and deserialized from and to epoch milliseconds.

Summary

Public constructors

Public methods

@NonNull Instant
deserialize(long epochMilli)

Deserializes a long to an Instant.

long

Serializes an Instant to a long.

Public constructors

InstantAsLongSerializer

Added in 1.2.0-alpha01
public InstantAsLongSerializer()

Public methods

deserialize

Added in 1.2.0-alpha01
public @NonNull Instant deserialize(long epochMilli)

Deserializes a long to an Instant.

Parameters
long epochMilli

The long to deserialize.

Returns
@NonNull Instant

The Instant deserialized from the long.

serialize

Added in 1.2.0-alpha01
public long serialize(@NonNull Instant instant)

Serializes an Instant to a long.

Parameters
@NonNull Instant instant

The Instant to serialize.

Returns
long

The long serialized from the Instant.