org.sapia.ubik.net
Class TCPAddress

java.lang.Object
  extended by org.sapia.ubik.net.TCPAddress
All Implemented Interfaces:
java.io.Externalizable, java.io.Serializable, ServerAddress
Direct Known Subclasses:
HttpAddress, NioAddress

public class TCPAddress
extends java.lang.Object
implements java.io.Externalizable, ServerAddress

This class models a TCP "server address". This class encapsulates host and port information.

Author:
Yanick Duchesne
Copyright:
Copyright © 2002-2003 Sapia Open Source Software. All Rights Reserved.
License:
Read the license.txt file of the jar or visit the license page at the Sapia OSS web site
See Also:
Serialized Form

Field Summary
protected  java.lang.String _transportType
           
static java.lang.String TRANSPORT_TYPE
           
 
Constructor Summary
TCPAddress()
          Do not call; used for externalization only.
TCPAddress(java.lang.String host, int port)
          Creates an instance of this class with the given host and port information.
 
Method Summary
 boolean equals(java.lang.Object obj)
          Overrides equals; two host identifiers are equal if they have the same host and port.
 java.lang.String getHost()
          Returns the address of the host to which this instance corresponds.
 int getPort()
          Returns the port of the server to which this instance corresponds.
 java.lang.String getTransportType()
          Returns the "transport type" of the server corresponding to this server address.
 int hashCode()
          This method returns a hash code based on this instances host and port.
 void readExternal(java.io.ObjectInput in)
           
 java.lang.String toString()
          Returns a string representation of this instance.
 void writeExternal(java.io.ObjectOutput out)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

TRANSPORT_TYPE

public static final java.lang.String TRANSPORT_TYPE
See Also:
Constant Field Values

_transportType

protected java.lang.String _transportType
Constructor Detail

TCPAddress

public TCPAddress()
Do not call; used for externalization only.


TCPAddress

public TCPAddress(java.lang.String host,
                  int port)
Creates an instance of this class with the given host and port information.

Parameters:
host - the address of a host.
port - the port of the server running on the given host.
Method Detail

equals

public boolean equals(java.lang.Object obj)
Overrides equals; two host identifiers are equal if they have the same host and port.

Specified by:
equals in interface ServerAddress
Overrides:
equals in class java.lang.Object
Parameters:
obj - the instance with which to perform the comparison.
See Also:
Object.equals(Object obj).

getHost

public java.lang.String getHost()
Returns the address of the host to which this instance corresponds.

Returns:
this instance's host address.

getPort

public int getPort()
Returns the port of the server to which this instance corresponds.

Returns:
a server port..

hashCode

public int hashCode()
This method returns a hash code based on this instances host and port.

Overrides:
hashCode in class java.lang.Object
Returns:
a hash code, as an int.

readExternal

public void readExternal(java.io.ObjectInput in)
                  throws java.io.IOException,
                         java.lang.ClassNotFoundException
Specified by:
readExternal in interface java.io.Externalizable
Throws:
java.io.IOException
java.lang.ClassNotFoundException
See Also:
Externalizable.readExternal(ObjectInput)

writeExternal

public void writeExternal(java.io.ObjectOutput out)
                   throws java.io.IOException
Specified by:
writeExternal in interface java.io.Externalizable
Throws:
java.io.IOException
See Also:
Externalizable.writeExternal(ObjectOutput)

getTransportType

public java.lang.String getTransportType()
Description copied from interface: ServerAddress
Returns the "transport type" of the server corresponding to this server address. A transport type is an arbitrary, logical identifier.

Specified by:
getTransportType in interface ServerAddress
Returns:
a transport type, as a String.
See Also:
ServerAddress.getTransportType()

toString

public java.lang.String toString()
Returns a string representation of this instance.

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


Copyright © 2010 Sapia OSS. All Rights Reserved.