solar.service.transport
Class SocketAddress

java.lang.Object
  |
  +--solar.service.transport.SocketAddress
All Implemented Interfaces:
Address, java.io.Serializable

public class SocketAddress
extends java.lang.Object
implements Address

Network address identified by IP and a port number.

Version:
$Id: SocketAddress.java,v 1.12 2003/10/05 18:51:03 glchen Exp $
Author:
Guanling Chen
See Also:
Serialized Form

Field Summary
protected  int _hashcode
           
private  java.net.InetAddress _inetAddress
           
private  int _port
           
protected  java.lang.String _string
           
 
Constructor Summary
SocketAddress(java.net.InetAddress addr, int port)
          Constructs a socket address with a inet address and port number.
SocketAddress(java.net.InetSocketAddress saddr)
          Constructs a socket address with a inet socket address.
SocketAddress(java.lang.String pair)
          Constructs a socket address with ip_address:port_number argument.
SocketAddress(java.lang.String host, int port)
          Constructs a socket address with a host name and port number.
 
Method Summary
private  void construction()
          common constructor operations.
 boolean equals(java.lang.Object obj)
          Test whether two addresses are equals.
 int getEncoding()
          Return the encoding of this address.
 java.net.InetAddress getInetAddress()
          Return IP address.
 int getPort()
          Return port number.
 int hashCode()
          Return the hash code of this address.
 byte[] toBytes()
          Return the byte array representation of this address.
 java.lang.String toString()
          Return the string representation of this address.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

_inetAddress

private java.net.InetAddress _inetAddress

_port

private int _port

_string

protected java.lang.String _string

_hashcode

protected int _hashcode
Constructor Detail

SocketAddress

public SocketAddress(java.lang.String host,
                     int port)
              throws java.lang.Exception
Constructs a socket address with a host name and port number.


SocketAddress

public SocketAddress(java.net.InetAddress addr,
                     int port)
              throws java.lang.Exception
Constructs a socket address with a inet address and port number.


SocketAddress

public SocketAddress(java.net.InetSocketAddress saddr)
Constructs a socket address with a inet socket address.


SocketAddress

public SocketAddress(java.lang.String pair)
              throws java.lang.Exception
Constructs a socket address with ip_address:port_number argument.

Method Detail

construction

private void construction()
common constructor operations.


toString

public java.lang.String toString()
Description copied from interface: Address
Return the string representation of this address.

Specified by:
toString in interface Address
Overrides:
toString in class java.lang.Object

toBytes

public byte[] toBytes()
Description copied from interface: Address
Return the byte array representation of this address.

Specified by:
toBytes in interface Address

getEncoding

public int getEncoding()
Description copied from interface: Address
Return the encoding of this address.

Specified by:
getEncoding in interface Address

equals

public boolean equals(java.lang.Object obj)
Description copied from interface: Address
Test whether two addresses are equals.

Specified by:
equals in interface Address
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Description copied from interface: Address
Return the hash code of this address.

Specified by:
hashCode in interface Address
Overrides:
hashCode in class java.lang.Object

getInetAddress

public java.net.InetAddress getInetAddress()
Return IP address.


getPort

public int getPort()
Return port number.