org.softamis.net.localinfo
Interface LocalNetworkInfoProvider

All Known Implementing Classes:
DefaultLocalNetworkInfoProvider

public interface LocalNetworkInfoProvider

Generic interface which provides information about the system. Supports both single and multi-home (one that includes more than one network cards and therefore network interfaces) configurations

Author:
Andrew Sazonov

Method Summary
 java.net.InetAddress getLocalAddress()
          Tries to obtain local address of machine based on InetAddress
 java.util.List<java.net.InetAddress> getLocalAddresses(InetAddressAcceptor aAcceptor)
          Collects all local addresses (more than one on multihome system) and applies given acceptor on them for selecting particular ones that accepted by acceptor
 byte[] getLocalAddressRaw()
          Returns information about local address in raw format
 java.lang.String getLocalHostAddress()
          Tries to obtain information about local host address
 java.util.List<java.lang.String> getLocalHostAddresses(InetAddressAcceptor aAcceptor)
          Collects all addresses of local host and filters them based on given acceptor
 java.util.List<java.net.NetworkInterface> getNetworkInterfaces(InetAddressAcceptor aAcceptor)
          Collects all network interfaces on the local machine and filters them based on given acceptor.
 

Method Detail

getLocalAddress

java.net.InetAddress getLocalAddress()
                                     throws java.net.UnknownHostException
Tries to obtain local address of machine based on InetAddress

Returns:
resolved address
Throws:
java.net.UnknownHostException
See Also:
InetAddress.getLocalHost()

getLocalAddressRaw

byte[] getLocalAddressRaw()
Returns information about local address in raw format

See Also:
getLocalAddress()

getLocalHostAddress

java.lang.String getLocalHostAddress()
                                     throws java.net.UnknownHostException
Tries to obtain information about local host address

Returns:
Throws:
java.net.UnknownHostException

getLocalAddresses

java.util.List<java.net.InetAddress> getLocalAddresses(InetAddressAcceptor aAcceptor)
                                                       throws java.net.SocketException
Collects all local addresses (more than one on multihome system) and applies given acceptor on them for selecting particular ones that accepted by acceptor

Parameters:
aAcceptor - acceptor used to filter addresses
Returns:
list of local addresses for current machine
Throws:
java.net.SocketException

getNetworkInterfaces

java.util.List<java.net.NetworkInterface> getNetworkInterfaces(InetAddressAcceptor aAcceptor)
                                                               throws java.net.SocketException
Collects all network interfaces on the local machine and filters them based on given acceptor.

Parameters:
aAcceptor - acceptor used to filter inet addresses on network interfaces
Returns:
list of network interfaces that has local addresses that match given acceptor
Throws:
java.net.SocketException

getLocalHostAddresses

java.util.List<java.lang.String> getLocalHostAddresses(InetAddressAcceptor aAcceptor)
                                                       throws java.net.SocketException
Collects all addresses of local host and filters them based on given acceptor

Parameters:
aAcceptor - acceptor used to filter inet addresses on network interfaces
Returns:
list of local host addresses that match given acceptor
Throws:
java.net.SocketException