T
- the Protocol Buffers GeneratedMessageV3
type handled by
this StreamSerializer
.public abstract class ProtobufSerializer<T extends com.google.protobuf.GeneratedMessageV3> extends Object implements StreamSerializer<T>
StreamSerializer
interface.
To learn how to use this class, visit Jet's Serialization Guide. In brief, you should create a subclass that does nothing else but call this class's protected constructor, and then you can use it in two ways:
jobConfig.registerSerializer(MyType.class, MyTypeSerializer.class)
.
Modifier | Constructor and Description |
---|---|
protected |
ProtobufSerializer(Class<T> clazz,
int typeId)
Called by the subclass to initialize this protobuf serializer.
|
Modifier and Type | Method and Description |
---|---|
static <T extends com.google.protobuf.GeneratedMessageV3> |
from(Class<T> clazz,
int typeId)
An utility method that creates an anonymous
ProtobufSerializer . |
int |
getTypeId()
Uniquely identifies given serializer.
|
T |
read(ObjectDataInput in)
Reads object from objectDataInputStream
|
void |
write(ObjectDataOutput out,
T object)
This method writes object to ObjectDataOutput
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
destroy
public int getTypeId()
Serializer
getTypeId
in interface Serializer
public void write(ObjectDataOutput out, T object) throws IOException
StreamSerializer
write
in interface StreamSerializer<T extends com.google.protobuf.GeneratedMessageV3>
out
- ObjectDataOutput stream that object will be written toobject
- that will be written to outIOException
- in case of failure to writepublic T read(ObjectDataInput in) throws IOException
StreamSerializer
read
in interface StreamSerializer<T extends com.google.protobuf.GeneratedMessageV3>
in
- ObjectDataInput stream that object will read fromIOException
- in case of failure to read@Nonnull public static <T extends com.google.protobuf.GeneratedMessageV3> ProtobufSerializer<T> from(@Nonnull Class<T> clazz, int typeId)
ProtobufSerializer
.T
- the Protocol Buffers GeneratedMessageV3
type
handled by created StreamSerializer
clazz
- GeneratedMessageV3
type of created serializertypeId
- unique type id of created serializerCopyright © 2023 Hazelcast, Inc.. All rights reserved.