Package org.apache.cassandra.locator
Class InetAddressAndPort.Serializer
- java.lang.Object
-
- org.apache.cassandra.locator.InetAddressAndPort.Serializer
-
- All Implemented Interfaces:
IVersionedAsymmetricSerializer<InetAddressAndPort,InetAddressAndPort>,IVersionedSerializer<InetAddressAndPort>
- Enclosing class:
- InetAddressAndPort
public static final class InetAddressAndPort.Serializer extends java.lang.Object implements IVersionedSerializer<InetAddressAndPort>
As of version 4.0 the endpoint description includes a port number as an unsigned short This serializer matches the 3.0 CompactEndpointSerializationHelper, encoding the number of address bytes in a single byte before the address itself.
-
-
Field Summary
Fields Modifier and Type Field Description static InetAddressAndPort.SerializerinetAddressAndPortSerializerstatic intMAXIMUM_SIZE
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description InetAddressAndPortdeserialize(DataInputPlus in, int version)Deserialize into the specified DataInputStream instance.InetAddressAndPortextract(java.nio.ByteBuffer buf, int position)ExtractInetAddressAndPortfrom the providedByteBufferwithout altering its state.voidserialize(java.net.InetSocketAddress endpoint, DataOutputPlus out, int version)voidserialize(InetAddressAndPort endpoint, DataOutputPlus out, int version)Serialize the specified type into the specified DataOutputStream instance.longserializedSize(java.net.InetSocketAddress from, int version)longserializedSize(InetAddressAndPort from, int version)Calculate serialized size of object without actually serializing.
-
-
-
Field Detail
-
MAXIMUM_SIZE
public static final int MAXIMUM_SIZE
- See Also:
- Constant Field Values
-
inetAddressAndPortSerializer
public static final InetAddressAndPort.Serializer inetAddressAndPortSerializer
-
-
Method Detail
-
serialize
public void serialize(InetAddressAndPort endpoint, DataOutputPlus out, int version) throws java.io.IOException
Description copied from interface:IVersionedAsymmetricSerializerSerialize the specified type into the specified DataOutputStream instance.- Specified by:
serializein interfaceIVersionedAsymmetricSerializer<InetAddressAndPort,InetAddressAndPort>- Parameters:
endpoint- type that needs to be serializedout- DataOutput into which serialization needs to happen.version- protocol version- Throws:
java.io.IOException- if serialization fails
-
serialize
public void serialize(java.net.InetSocketAddress endpoint, DataOutputPlus out, int version) throws java.io.IOException- Throws:
java.io.IOException
-
deserialize
public InetAddressAndPort deserialize(DataInputPlus in, int version) throws java.io.IOException
Description copied from interface:IVersionedAsymmetricSerializerDeserialize into the specified DataInputStream instance.- Specified by:
deserializein interfaceIVersionedAsymmetricSerializer<InetAddressAndPort,InetAddressAndPort>- Parameters:
in- DataInput from which deserialization needs to happen.version- protocol version- Returns:
- the type that was deserialized
- Throws:
java.io.IOException- if deserialization fails
-
extract
public InetAddressAndPort extract(java.nio.ByteBuffer buf, int position) throws java.io.IOException
ExtractInetAddressAndPortfrom the providedByteBufferwithout altering its state.- Throws:
java.io.IOException
-
serializedSize
public long serializedSize(InetAddressAndPort from, int version)
Description copied from interface:IVersionedAsymmetricSerializerCalculate serialized size of object without actually serializing.- Specified by:
serializedSizein interfaceIVersionedAsymmetricSerializer<InetAddressAndPort,InetAddressAndPort>- Parameters:
from- object to calculate serialized sizeversion- protocol version- Returns:
- serialized size of object t
-
serializedSize
public long serializedSize(java.net.InetSocketAddress from, int version)
-
-