public class IPAddr extends Object
Modifier and Type | Method and Description |
---|---|
static IPAddr |
getAddress(String netAddress) |
static IPAddr |
getAddress(String netAddress,
int maskLength)
Get ipAddress for the given String and netmask
|
static String |
getInAddress(String ipAddress)
This method return the InAddress for the given ip.
|
String |
getIPAddress() |
String |
getMaskedIPAddress() |
int |
getMaskLength()
Get mask length
|
String |
getNibbleFormat()
Return the NibbleFormat of the IPAddr
|
static String |
getProperIpAddress(String ip)
This method convert the given ip to the proper format.
|
static String |
getReadableIP(String ip)
This method try to covnert an ip address to an easy readable ip.
|
String |
getReverseIP()
Get reverse ipAddress
|
static boolean |
isIPAddr(String data)
Check if a the Object is instance of this class
|
static boolean |
isIPV6(String ip)
Return if the given ipAddress is ipv6
|
static boolean |
isValidIP(String ip)
Check if the given IP is valid.
|
void |
setMask(int maskLength)
create series of 16 bit masks for each ip block
|
static String |
stripDot(String data)
Strip the last char of a string when it ends with a dot
|
String |
toString() |
public static IPAddr getAddress(String netAddress, int maskLength) throws PermErrorException
netAddress
- The ipAddress given as StringmaskLength
- The netmaskPermErrorException
- on errorpublic static IPAddr getAddress(String netAddress) throws PermErrorException
PermErrorException
getAddress(String, int)
public static boolean isIPAddr(String data)
data
- The object to checkpublic void setMask(int maskLength)
maskLength
- The netmaskpublic static String stripDot(String data)
data
- The String where the dot should removedpublic String getIPAddress()
getInAddress(String)
public String getMaskedIPAddress()
getIPAddress(int[])
public String getNibbleFormat()
public String getReverseIP()
public int getMaskLength()
public static String getInAddress(String ipAddress) throws PermErrorException
ipAddress
- -
ipAddress that should be processedPermErrorException
- if the ipAddress is not valid (rfc conform)public static boolean isValidIP(String ip)
ip
- The ipaddress to checkpublic static boolean isIPV6(String ip)
ip
- The ipAddresspublic static String getReadableIP(String ip)
ip
- The ip which should be tried to convertpublic static String getProperIpAddress(String ip) throws PermErrorException
ip
- the ipAddress to convertPermErrorException
- if the given ipAddress is invalidCopyright © 2006–2016 The Apache Software Foundation. All rights reserved.