Class ChannelInfoSerializer
java.lang.Object
pt.unl.fct.di.novasys.babel2.protocols.discovery.serializers.ChannelInfoSerializer
- All Implemented Interfaces:
BabelNetworkSerializer<ChannelInfo>
@AutoService(BabelNetworkSerializer.class)
public class ChannelInfoSerializer
extends Object
implements BabelNetworkSerializer<ChannelInfo>
Network serializer for
ChannelInfo records.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondeserialize(io.netty.buffer.ByteBuf in, NodeStore store) Reads an instance ofTfrom the supplied buffer.intgetEstimateSize(ChannelInfo object, NodeStore store) Returns a size estimate to fit the entire object in aByteBufwithout needing resizes.Returns the class of objects handled by this serializer, used for registry lookup.voidserialize(ChannelInfo object, io.netty.buffer.ByteBuf out, NodeStore store) Encodesobjectand appends the resulting bytes toout.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface BabelNetworkSerializer
getEstimateSizeModifier and TypeMethodDescriptiondefault intgetEstimateSize(ChannelInfo object) Returns an estimated size in bytes for the given object.
-
Constructor Details
-
ChannelInfoSerializer
public ChannelInfoSerializer()Constructs a newChannelInfoSerializer.
-
-
Method Details
-
deserialize
Description copied from interface:BabelNetworkSerializerReads an instance ofTfrom the supplied buffer. The buffer's reader index must be positioned at the first byte of the encoded object. Upon return the reader index is advanced past all bytes consumed.- Specified by:
deserializein interfaceBabelNetworkSerializer<ChannelInfo>- Parameters:
in- the source bufferstore- the node store context for resolving node components- Returns:
- the deserialized object
-
serialize
Description copied from interface:BabelNetworkSerializerEncodesobjectand appends the resulting bytes toout.- Specified by:
serializein interfaceBabelNetworkSerializer<ChannelInfo>- Parameters:
object- the object to serializeout- the destination bufferstore- the node store context for resolving node components
-
getObjectClass
Description copied from interface:BabelNetworkSerializerReturns the class of objects handled by this serializer, used for registry lookup.- Specified by:
getObjectClassin interfaceBabelNetworkSerializer<ChannelInfo>- Returns:
- the handled class
-
getEstimateSize
Description copied from interface:BabelNetworkSerializerReturns a size estimate to fit the entire object in aByteBufwithout needing resizes. The default implementation returns 0. For maximum serialization performance, override this method.- Specified by:
getEstimateSizein interfaceBabelNetworkSerializer<ChannelInfo>- Parameters:
object- the object to estimate the sizestore- the node store for node lookups during size estimation, ornull- Returns:
- the expected size in bytes to fit the object in a
ByteBuf
-