CTL.Types
Class PeerID

java.lang.Object
  extended by CTL.Types.PeerID
All Implemented Interfaces:
Writable

public class PeerID
extends java.lang.Object
implements Writable

ID of a remote peer


Field Summary
private  IPaddr host
          IP address
private  int port
          Port
 
Constructor Summary
PeerID(IPaddr host, int port)
          Generate a new PeerID
PeerID(java.lang.String host, int port)
           
 
Method Summary
 IPaddr host()
          Retrieve the IP address of the peer
 int port()
          Retrieve the port of the peer
 void read(SerialIn in)
          Serial read function
 void setHost(IPaddr host)
          Set the IP address
 void setPort(int port)
          Set the port
 int size()
          Determine the size of this type
 java.lang.String toString()
          Retrieve a string representation of this object
 void write(SerialOut out)
          Serial read function
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

host

private IPaddr host
IP address


port

private int port
Port

Constructor Detail

PeerID

public PeerID(IPaddr host,
              int port)
Generate a new PeerID

Parameters:
host - Host
port - Port

PeerID

public PeerID(java.lang.String host,
              int port)
       throws java.net.UnknownHostException
Throws:
java.net.UnknownHostException
Method Detail

toString

public java.lang.String toString()
Retrieve a string representation of this object

Overrides:
toString in class java.lang.Object
Returns:
String

host

public IPaddr host()
Retrieve the IP address of the peer

Returns:
IP address

port

public int port()
Retrieve the port of the peer

Returns:
Port

setHost

public void setHost(IPaddr host)
Set the IP address

Parameters:
host - IP address

setPort

public void setPort(int port)
Set the port

Parameters:
port - Port

read

public void read(SerialIn in)
          throws java.io.IOException,
                 java.lang.ClassNotFoundException,
                 java.lang.InstantiationException,
                 java.lang.IllegalAccessException,
                 java.lang.reflect.InvocationTargetException
Serial read function

Specified by:
read in interface Writable
Parameters:
in - Input stream
Throws:
java.io.IOException
java.lang.ClassNotFoundException
java.lang.InstantiationException
java.lang.IllegalAccessException
java.lang.reflect.InvocationTargetException

write

public void write(SerialOut out)
           throws java.io.IOException,
                  java.lang.IllegalAccessException,
                  java.lang.reflect.InvocationTargetException,
                  CTLException
Serial read function

Specified by:
write in interface Writable
Parameters:
out - Output stream
Throws:
java.io.IOException
java.lang.IllegalAccessException
java.lang.reflect.InvocationTargetException
CTLException

size

public int size()
Determine the size of this type

Returns:
Size (in bytes)