public final class DbIpClient
extends java.lang.Object
Constructor and Description |
---|
DbIpClient(java.io.File gzip)
Create a new DbIpClient .
|
Modifier and Type | Method and Description |
---|---|
java.util.TreeMap<java.lang.Integer,GeoEntity> |
getIpv4Repo() |
GeoEntity |
lookup(java.net.InetAddress inetAddress)
Returns a loaded GeoEntity object for a given
inetAddress
If nothing can be resolved for an inetAddress , then the city,state and country
for the GeoEntity will be set to 'Unknown' |
GeoEntity |
lookup(java.lang.String ip)
Returns a loaded GeoEntity object for a given
ip
If nothing can be resolved for an ip , then the city,state and country
for the GeoEntity will be set to 'Unknown'
Any futher initializations of the DbIpClient will not load data into memory again. |
public DbIpClient(java.io.File gzip)
gzip
- The dbip-city-latest.csv.gz file as a File object.java.lang.IllegalArgumentException
- if gzip
does not exist.public GeoEntity lookup(java.lang.String ip)
ip
If nothing can be resolved for an ip
, then the city,state and country
for the GeoEntity will be set to 'Unknown'
Any futher initializations of the DbIpClient will not load data into memory again.ip
- The ip (as String) to be resolved.public GeoEntity lookup(java.net.InetAddress inetAddress)
inetAddress
If nothing can be resolved for an inetAddress
, then the city,state and country
for the GeoEntity will be set to 'Unknown'inetAddress
- The inetAddress (as InetAddress) to be resolved.public java.util.TreeMap<java.lang.Integer,GeoEntity> getIpv4Repo()