Package network
Class Host
java.lang.Object
network.Host
- All Implemented Interfaces:
Comparable<Host>
public class Host extends Object implements Comparable<Host>
Represents a node in the network layer, including its IP Address and listen port
- Author:
- pfouto
-
Constructor Summary
Constructors Constructor Description Host(InetAddress address, int port)Creates a new host with the given address and port -
Method Summary
Modifier and Type Method Description intcompareTo(Host other)static Hostdeserialize(io.netty.buffer.ByteBuf in)booleanequals(Object other)InetAddressgetAddress()Gets the address of this hostintgetPort()Gets the port of this hostinthashCode()voidserialize(io.netty.buffer.ByteBuf out)intserializedSize()StringtoString()
-
Constructor Details
-
Host
Creates a new host with the given address and port- Parameters:
address- The address of the host to createport- The port of the host to create
-
-
Method Details
-
getAddress
Gets the address of this host- Returns:
- The INetAddress
-
getPort
public int getPort()Gets the port of this host- Returns:
- The port
-
toString
-
equals
-
hashCode
public int hashCode() -
serialize
public void serialize(io.netty.buffer.ByteBuf out) -
deserialize
- Throws:
UnknownHostException
-
serializedSize
public int serializedSize() -
compareTo
- Specified by:
compareToin interfaceComparable<Host>
-