public class TimestampSerializer extends Object implements Serializer<Timestamp>
Timestamp
.
A Timestamp
instance can be compactly serialized as a long value(= millisecond) when
the Timestamp type is compact. Otherwise it's serialized as a long value and a int value.
Constructor and Description |
---|
TimestampSerializer(int precision) |
Modifier and Type | Method and Description |
---|---|
Timestamp |
copy(Timestamp from)
Creates a deep copy of the given element in a new element.
|
Timestamp |
deserialize(DataInputView source)
De-serializes a record from the given source input view.
|
Timestamp |
deserializeFromString(String s)
De-serializes a record from string.
|
Serializer<Timestamp> |
duplicate()
Creates a deep copy of this serializer if it is necessary, i.e.
|
boolean |
equals(Object obj) |
int |
hashCode() |
void |
serialize(Timestamp record,
DataOutputView target)
Serializes the given record to the given target output view.
|
String |
serializeToString(Timestamp record)
Serializes the given record to string.
|
public Serializer<Timestamp> duplicate()
Serializer
We need this because Serializers might be used in several threads. Stateless serializers are inherently thread-safe while stateful serializers might not be thread-safe.
duplicate
in interface Serializer<Timestamp>
public Timestamp copy(Timestamp from)
Serializer
copy
in interface Serializer<Timestamp>
from
- The element reuse be copied.public void serialize(Timestamp record, DataOutputView target) throws IOException
Serializer
serialize
in interface Serializer<Timestamp>
record
- The record to serialize.target
- The output view to write the serialized data to.IOException
- Thrown, if the serialization encountered an I/O related error. Typically
raised by the output view, which may have an underlying I/O channel to which it
delegates.public Timestamp deserialize(DataInputView source) throws IOException
Serializer
deserialize
in interface Serializer<Timestamp>
source
- The input view from which to read the data.IOException
- Thrown, if the de-serialization encountered an I/O related error.
Typically raised by the input view, which may have an underlying I/O channel from which
it reads.public String serializeToString(Timestamp record)
Serializer
serializeToString
in interface Serializer<Timestamp>
record
- The record to serialize.public Timestamp deserializeFromString(String s)
Serializer
deserializeFromString
in interface Serializer<Timestamp>
s
- The string to de-serialize.Copyright © 2023–2024 The Apache Software Foundation. All rights reserved.