T
- type of the serialized objectpublic interface StreamSerializer<T> extends Serializer
final SerializerConfig serializerConfig = new SerializerConfig(); serializerConfig.setImplementation(new StreamSerializer<Person>() { public int getTypeId() { } public void destroy() { } public void write(ObjectDataOutput out, Person object) throws IOException { } public Person read(ObjectDataInput in) throws IOException { }); serializerConfig.setTypeClass(Person.class); config.getSerializationConfig().addSerializerConfig(serializerConfig);There is another class with byte arrays can be used instead ıf this interface see
ByteArraySerializer
.
C++ and C# clients also have compatible methods so that with custom serialization client can also be used
Note that read and write methods should be compatible
Modifier and Type | Method and Description |
---|---|
T |
read(ObjectDataInput in)
Reads object from objectDataInputStream
|
void |
write(ObjectDataOutput out,
T object)
This method writes object to ObjectDataOutput
|
destroy, getTypeId
void write(ObjectDataOutput out, T object) throws IOException
out
- ObjectDataOutput stream that object will be written toobject
- that will be written to outIOException
- in case of failure to writeT read(ObjectDataInput in) throws IOException
in
- ObjectDataInput stream that object will read fromIOException
- in case of failure to readCopyright © 2021 Hazelcast, Inc.. All rights reserved.