diff --git a/README.md b/README.md index 9811cac..4e48d6a 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,29 @@ A simple to use Java library for the freely available DB-IP [IP address to city #Before you begin The entire dataset is loaded into a [TreeMap](https://docs.oracle.com/javase/8/docs/api/allclasses-noframe.html) . Make sure that you have about **3 GB of Heap space** available to load it. +#Get + +With maven : + +```xml + + + in.ankushs + Java-DB-IP + 1.0 + +``` + +Or gradle: + +```groovy + +compile('in.ankushs:Java-DB-IP:1.0') + +``` + +The Javadocs for the latest release can be found [here](http://www.javadoc.io/doc/in.ankushs/Java-DB-IP/1.0) + #Instructions In order to get geographical information for an ip address, just pass the `dbip-city-latest.csv.gz` as a File object to `DbIpClient` as follows: diff --git a/build.gradle b/build.gradle index 2f9f5a4..9d6b9bb 100644 --- a/build.gradle +++ b/build.gradle @@ -11,7 +11,7 @@ archivesBaseName = "dbip" version = '1.0' jar { - baseName = "Java DB-IP" + baseName = "Java-DB-IP" manifest { attributes 'Implementation-Title': 'Gradle Quickstart', 'Implementation-Version': version @@ -31,13 +31,13 @@ dependencies { testCompile('org.codehaus.groovy:groovy-all:2.4.5') } -sourceSets { - main { - java { srcDirs = ["src/main/java"] } // no source dirs for the java compiler - groovy { srcDirs = ["src/test/groovy"] } // compile everything in src/ with groovy - } - } - +//sourceSets { +// main { +// java { srcDirs = ["src/main/java"] } // no source dirs for the java compiler +// groovy { srcDirs = ["src/test/groovy"] } // compile everything in src/ with groovy +// } +// } +// test { systemProperties 'property': 'value' } diff --git a/gradle.properties b/gradle.properties index a85f30f..e69de29 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +0,0 @@ -#signing.keyId= -#signing.password= -#signing.secretKeyRingFile= -# -#ossrhUsername= -#ossrhPassword= \ No newline at end of file diff --git a/src/main/java/in/ankushs/dbip/api/DbIpClient.java b/src/main/java/in/ankushs/dbip/api/DbIpClient.java index af6512b..a7d64c2 100644 --- a/src/main/java/in/ankushs/dbip/api/DbIpClient.java +++ b/src/main/java/in/ankushs/dbip/api/DbIpClient.java @@ -64,8 +64,8 @@ public DbIpClient(final File gzip){ * If nothing can be resolved for an {@code 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. - * @param gzip The dbip-city-latest.csv.gz file as a File object. - * @throws InvalidIPException if {@code ip} is not a valid IP address. + * @param ip The ip (as String) to be resolved. + * @return a GeoEntity object representing city,state and province info */ public GeoEntity lookup(final String ip){ InetAddress inetAddress = null; @@ -83,8 +83,8 @@ public GeoEntity lookup(final String ip){ * Returns a loaded GeoEntity object for a given {@code inetAddress} * If nothing can be resolved for an {@code inetAddress} , then the city,state and country * for the GeoEntity will be set to 'Unknown' - * @param gzip The dbip-city-latest.csv.gz file as a File object. - * @throws InvalidIPException if {@code inetAddress} is not a valid IP address. + * @param inetAddress The inetAddress (as InetAddress) to be resolved. + * @return a GeoEntity object representing city,state and province info */ public GeoEntity lookup(final InetAddress inetAddress){ PreConditions.checkNull(inetAddress, "inetAddress cannot be null"); diff --git a/src/main/java/in/ankushs/dbip/importer/ResourceImporter.java b/src/main/java/in/ankushs/dbip/importer/ResourceImporter.java index e4e1809..838b9e4 100644 --- a/src/main/java/in/ankushs/dbip/importer/ResourceImporter.java +++ b/src/main/java/in/ankushs/dbip/importer/ResourceImporter.java @@ -49,8 +49,7 @@ public static ResourceImporter getInstance() { * Loads the file into JVM,reading line by line. * Also transforms each line into a GeoEntity object, and save the object into the * repository. - * @param gzip The dbip-city-latest.csv.gz file as a File object. - * @throws IOException if {@code file} does not exist or is not gzipped. + * @param file The dbip-city-latest.csv.gz file as a File object. */ public void load(final File file) {