org.fossilec.odettej.transport.tcp
Class InternetAddress

java.lang.Object
  extended by org.fossilec.odettej.transport.NetworkAddress
      extended by org.fossilec.odettej.transport.tcp.InternetAddress
All Implemented Interfaces:
java.io.Serializable

public class InternetAddress
extends NetworkAddress

This class represents the TCP/IP network address used over the API with Internet transport layer implementation. The address type is internet.

In general form it's formed with Hostname (or IP address) and the Port number.

Author:
Rafael Marins
See Also:
NetworkAddress, Serialized Form

Constructor Summary
InternetAddress(java.lang.String address)
          Common way of creating an Address object using the String representation of the address.
InternetAddress(java.lang.String host, int port)
          Way of creating the Address object using properly parameters.
 
Method Summary
protected static java.net.InetSocketAddress createAddress(java.lang.String address)
           
protected static java.net.InetSocketAddress createAddress(java.lang.String host, int port)
           
 java.lang.String getHost()
          Gets the hostname part of the address.
 int getPort()
          Return the port number, a non-negative integer.
 java.lang.String getType()
          Gets address type.
protected  void parse(java.lang.String address)
          Allow the setting up of subclasses context when invoked created through general constructor NetworkAddress(String).
 java.lang.String toString()
          Return the String representation of this address object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

InternetAddress

public InternetAddress(java.lang.String address)
                throws AddressException
Common way of creating an Address object using the String representation of the address.

Parameters:
address - String representation of the network address.
Throws:
AddressException - Fail to parse the address.
See Also:
NetworkAddress#Address(String)

InternetAddress

public InternetAddress(java.lang.String host,
                       int port)
                throws AddressException
Way of creating the Address object using properly parameters.

Parameters:
host - String hostname.
port - int port number.
Throws:
AddressException - If fail to create the address.
Method Detail

getHost

public final java.lang.String getHost()
Gets the hostname part of the address.

Returns:
String hostname.

getPort

public final int getPort()
Return the port number, a non-negative integer.

Returns:
Port number, or 0 if undefined.

getType

public java.lang.String getType()
Gets address type.

Specified by:
getType in class NetworkAddress
Returns:
String address type "internet".

toString

public java.lang.String toString()
Return the String representation of this address object.

Specified by:
toString in class NetworkAddress
Returns:
String representation of this address.

parse

protected void parse(java.lang.String address)
              throws AddressException
Allow the setting up of subclasses context when invoked created through general constructor NetworkAddress(String).

Specified by:
parse in class NetworkAddress
Parameters:
address - String representation of the network address.
Throws:
AddressException - Fail to parse the address.
See Also:
NetworkAddress.parse(String)

createAddress

protected static java.net.InetSocketAddress createAddress(java.lang.String address)
                                                   throws AddressException
Parameters:
address -
Returns:
Throws:
java.lang.IllegalArgumentException - If the port parameter is outside the range of valid port values, of if the hostname parameter is null.
AddressException - If failt to create the address.

createAddress

protected static java.net.InetSocketAddress createAddress(java.lang.String host,
                                                          int port)
                                                   throws AddressException
Parameters:
host -
port -
Returns:
Throws:
java.lang.IllegalArgumentException - If the port parameter is outside the range of valid port values, of if the hostname parameter is null.
AddressException - If fail to create the address.


Copyright © 2005 ObjectWeb Consortium. All Rights Reserved.