osl.transport.udp
Class UDPAddress

java.lang.Object
  |
  +--osl.transport.udp.UDPAddress

public class UDPAddress
extends java.lang.Object
implements PhysicalAddress, java.io.Externalizable

This class defines the UDP implementation of the PhysicalAddress class expected by the transport layer component. An address is simply a machine name-port pair.

Version:
$Revision: 1.7 $ ($Date: 1999/07/13 02:01:51 $)
See Also:
PhysicalAddress, Serialized Form

Field Summary
 byte[] cache
          Cached serialized form of this address.
 java.net.InetAddress hostAddr
           
 int hostPort
          The port for this address.
 java.lang.String rep
          Cached string representation of this address.
 
Constructor Summary
UDPAddress()
          Default constructor
UDPAddress(java.net.InetAddress addr, int port)
          Full constructor
 
Method Summary
 boolean equals(java.lang.Object other)
          Compares two instances and returns true if they should be considered "equal".
 int hashCode()
          Returns the hashCode for this instace.
 void readExternal(java.io.ObjectInput in)
          Deserialize into a new instnace of UDPAddress by reading from the given input stream.
 java.lang.String toString()
          The canoncial toString method.
 void writeExternal(java.io.ObjectOutput out)
          Serialize the contents of this class to the output stream.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

hostAddr

public java.net.InetAddress hostAddr

hostPort

public int hostPort
The port for this address.

cache

public byte[] cache
Cached serialized form of this address. Useful for quick serialization and deserialization.

rep

public java.lang.String rep
Cached string representation of this address.
Constructor Detail

UDPAddress

public UDPAddress()
Default constructor

UDPAddress

public UDPAddress(java.net.InetAddress addr,
                  int port)
Full constructor
Parameters:
addr - The InetAddress to use for this address.
port - The port to use for this address.
Method Detail

equals

public boolean equals(java.lang.Object other)
Compares two instances and returns true if they should be considered "equal". We require this function so that UDPAddresses hash correctly.
Parameters:
other - The Object to which we are being compared.
Returns:
Returns true if both objects are UDPAddresses with the same hostAddr and hostPort. Returns false otherwise.
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Returns the hashCode for this instace. We require this function so that UDPAddresses hash properly.
Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
The canoncial toString method.
Overrides:
toString in class java.lang.Object

writeExternal

public void writeExternal(java.io.ObjectOutput out)
                   throws java.io.IOException
Serialize the contents of this class to the output stream.
Specified by:
writeExternal in interface java.io.Externalizable
Parameters:
out - The OutputStream to which we should write this instance.

readExternal

public void readExternal(java.io.ObjectInput in)
                  throws java.io.IOException,
                         java.lang.ClassNotFoundException
Deserialize into a new instnace of UDPAddress by reading from the given input stream.

Specified by:
readExternal in interface java.io.Externalizable
Parameters:
in - The InputStream from which we should deserialize this instance.
Throws:
java.io.IOException - Thrown if an I/O error is encountered while reading the input stream.
java.lang.ClassNotFoundException - Thrown if a class being deserialized from the input stream cannot be found by the class loader.
java.lang.ClassCastException - Thrown if a class deserialized from the input stream had an unexpected type.