org.xnap.commons.util
Class NetHelper

java.lang.Object
  extended by org.xnap.commons.util.NetHelper

public class NetHelper
extends Object

Provides a set of static methods for common network tasks.


Constructor Summary
NetHelper()
           
 
Method Summary
static void disableHttpProxy()
          Disables the use of a http proxy.
static void disableSocksProxy()
          Disables the use of a socks proxy.
static void enableHttpProxy(String host, int port)
          Enables the use of a http proxy at host:port.
static void enableSocksProxy(String host, int port)
          Enables the use of a socks proxy at host:port.
static String getErrorMessage(IOException e)
          Returns a sensible error message.
static long ipToLongHiFirst(byte[] address)
           
static String toIPAddressBigEndian(long ip)
          Converts ip from an integer value to a dotted string representation.
static String toIPAddressLittleEndian(long ip)
          Converts ip from an integer value to a dotted string representation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NetHelper

public NetHelper()
Method Detail

enableSocksProxy

public static void enableSocksProxy(String host,
                                    int port)
Enables the use of a socks proxy at host:port.

Parameters:
host - hostname of the proxy
port - port of the proxy

disableSocksProxy

public static void disableSocksProxy()
Disables the use of a socks proxy.


enableHttpProxy

public static void enableHttpProxy(String host,
                                   int port)
Enables the use of a http proxy at host:port.

Parameters:
host - hostname of the proxy
port - port of the proxy

disableHttpProxy

public static void disableHttpProxy()
Disables the use of a http proxy.


getErrorMessage

public static String getErrorMessage(IOException e)
Returns a sensible error message.


ipToLongHiFirst

public static long ipToLongHiFirst(byte[] address)

toIPAddressLittleEndian

public static String toIPAddressLittleEndian(long ip)
Converts ip from an integer value to a dotted string representation.


toIPAddressBigEndian

public static String toIPAddressBigEndian(long ip)
Converts ip from an integer value to a dotted string representation.



Copyright © 2004-2007 XNap Commons Team. All Rights Reserved.