|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.opengts.util.IPTools
public class IPTools
A set of tools for handling IP Adresses
Nested Class Summary | |
---|---|
static class |
IPTools.IPAddress
IPAddress class |
static class |
IPTools.IPAddressList
Manages a list of IP address blocks |
Field Summary | |
---|---|
static java.lang.String |
HOST_UNKNOWN
|
static java.lang.String |
IP_ADDR_ALL
|
protected static long |
IP_ADDR_MASK
|
protected static int |
IP_ADDR_SIZE
|
static java.lang.String |
IPAddressSeparator
|
static char |
IPAddressSeparatorChar
|
static IPTools.IPAddressList |
PrivateIPAddresses
|
Constructor Summary | |
---|---|
IPTools()
|
Method Summary | |
---|---|
protected static long |
_parseIPAddress(java.lang.String ipAddr)
Parses the specified IP address into it's binary form |
protected static long |
_parseIPMask(int m)
Parses an IP subnet mask [CHECK](better wording?) |
static java.lang.String |
getHostName()
Retruns name of the local host |
static java.lang.String |
getIPAddress(java.lang.String hostName)
Gets the IP adress of a specified host name though a DNS lookup |
static boolean |
isLocalhost(java.lang.String hostName)
Returns true if the specified hostname resolves to "localhost" |
static boolean |
isPrivateIPAddress(java.lang.String ipAddr)
Returns true if the specified IP address is private |
static boolean |
isValidIPAddress(java.lang.String ipAddr)
Returns true if the specified IP address is valid |
static void |
main(java.lang.String[] argv)
Main entry point for testing/debugging |
static long[] |
parseIPAddress(java.lang.String ipAddr)
Parses the specified IPAddress/Mask and returns the result in a 2-element array |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String HOST_UNKNOWN
public static final java.lang.String IP_ADDR_ALL
public static final char IPAddressSeparatorChar
public static final java.lang.String IPAddressSeparator
protected static final int IP_ADDR_SIZE
protected static final long IP_ADDR_MASK
public static final IPTools.IPAddressList PrivateIPAddresses
Constructor Detail |
---|
public IPTools()
Method Detail |
---|
public static java.lang.String getHostName()
public static java.lang.String getIPAddress(java.lang.String hostName)
hostName
- The specified host name
public static boolean isLocalhost(java.lang.String hostName)
hostName
- The host name to check
public static boolean isValidIPAddress(java.lang.String ipAddr)
ipAddr
- The String representation of an IP address
public static boolean isPrivateIPAddress(java.lang.String ipAddr)
ipAddr
- The String representation of an IP address
protected static long _parseIPAddress(java.lang.String ipAddr)
ipAddr
- The IP adress to parse as a string
protected static long _parseIPMask(int m)
m
- The length of the adress section
public static long[] parseIPAddress(java.lang.String ipAddr)
ipAddr
- The specified IPAddress/Mask
public static void main(java.lang.String[] argv)
argv
- Comand-line arguments
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |