Class ShortArraySerializer
java.lang.Object
pt.unl.fct.di.novasys.babel2.channels.serializers.collections.primitives.ShortArraySerializer
- All Implemented Interfaces:
BabelNetworkSerializer<short[]>
@AutoService(BabelNetworkSerializer.class)
public class ShortArraySerializer
extends Object
implements BabelNetworkSerializer<short[]>
Binary serializer for
short[] primitive arrays.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionshort[]deserialize(io.netty.buffer.ByteBuf in, NodeStore store) Reads an instance ofTfrom the supplied buffer.intgetEstimateSize(short[] object) Returns an estimated size in bytes for the given object.Class<short[]> Returns the class of objects handled by this serializer, used for registry lookup.voidEncodesobjectand 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(short[] object, @Nullable NodeStore store) Returns a size estimate to fit the entire object in aByteBufwithout needing resizes.
-
Constructor Details
-
ShortArraySerializer
public ShortArraySerializer()Constructs a newShortArraySerializer.
-
-
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<short[]>- 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<short[]>- 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<short[]>- Returns:
- the handled class
-
getEstimateSize
public int getEstimateSize(short[] object) Description copied from interface:BabelNetworkSerializerReturns an estimated size in bytes for the given object.- Specified by:
getEstimateSizein interfaceBabelNetworkSerializer<short[]>- Parameters:
object- the object to estimate- Returns:
- estimated byte size, or 0 if unknown
-