public class IPConverter
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
IPConverter.Country |
Modifier and Type | Method and Description |
---|---|
static IPConverter |
getInstance(java.io.File file)
Returns the reference to singleton object of this class.
|
long |
ip2num(java.lang.String ip)
Converts a given IP4 in a long number
|
IPConverter.Country |
locateIP(byte[] ip) |
IPConverter.Country |
locateIP(java.lang.String ip)
Returns a
IPConverter.Country respecting given IP4. |
public static IPConverter getInstance(java.io.File file)
public long ip2num(java.lang.String ip)
ip
- IP in "XX.XX.XX.XX" formatjava.lang.NumberFormatException
- If the string is not an IP address.public IPConverter.Country locateIP(java.lang.String ip)
IPConverter.Country
respecting given IP4.ip
- IP in "XX.XX.XX.XX" formatIPConverter.Country
of given IP, or null if the passed in string is
not an IP address or we fail to load the ip to country data file.java.io.IOException
public IPConverter.Country locateIP(byte[] ip)