com.buzzsurf.dns
Class Util

java.lang.Object
  |
  +--com.buzzsurf.dns.Util

public class Util
extends java.lang.Object

Static utilities used to convert IP Addresses between the various formats used internally by the java.net.InetAddress class and associated classes.

Version:
0.9
Author:
Paul Cowan (pwc21@yahoo.com)

Field Summary
static int INADDRSZ
           
 
Method Summary
static byte[] intToNumericFormat(int src)
          Converts the internal integer representation of an IPv4 into a binary address
static int numericToIntFormat(byte[] addr)
          Converts IPv4 binary address a single integer representation as used internally by Inet4Address
static java.lang.String numericToTextFormat(byte[] src)
          Converts IPv4 binary address into a string suitable for presentation.
static byte[] textToNumericFormat(java.lang.String src)
          Converts IPv4 address in its textual presentation form into its numeric binary form.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INADDRSZ

public static final int INADDRSZ
See Also:
Constant Field Values
Method Detail

intToNumericFormat

public static byte[] intToNumericFormat(int src)
Converts the internal integer representation of an IPv4 into a binary address

Returns:
a byte array representing an IPv4 numeric address

numericToIntFormat

public static int numericToIntFormat(byte[] addr)
Converts IPv4 binary address a single integer representation as used internally by Inet4Address

Returns:
an integer representation of the IPv4 address

numericToTextFormat

public static java.lang.String numericToTextFormat(byte[] src)
Converts IPv4 binary address into a string suitable for presentation.

Parameters:
src - a byte array representing an IPv4 numeric address
Returns:
a String representing the IPv4 address in textual representation format

textToNumericFormat

public static byte[] textToNumericFormat(java.lang.String src)
Converts IPv4 address in its textual presentation form into its numeric binary form.

Parameters:
src - a String representing an IPv4 address in standard format
Returns:
a byte array representing the IPv4 numeric address