Skip to content

Commit 64cbdfc

Browse files
committed
Apply automated reformatting
1 parent 468fed2 commit 64cbdfc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+1426
-1251
lines changed

CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,8 @@ CHANGELOG
137137
-------------------
138138

139139
* The following new anonymizer methods were added to
140-
`com.maxmind.geoip2.record.Traits` for use with GeoIP2 Precision Insights:
141-
`isAnonymous()`, `isAnonymousVpn()`, `isHostingProvider()`, `isPublicProxy()`,
140+
`com.maxmind.geoip2.record.Traits` for use with GeoIP2 Precision Insights:
141+
`isAnonymous()`, `isAnonymousVpn()`, `isHostingProvider()`, `isPublicProxy()`,
142142
and `isTorExitNode()`.
143143

144144
2.9.0 (2017-05-08)

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ object.
190190

191191
After you have created the `DatabaseReader`, you may then call one of the
192192
appropriate methods, e.g., `city` or `tryCity`, for your database. These
193-
methods take the IP address to be looked up. The methods with the `try`
193+
methods take the IP address to be looked up. The methods with the `try`
194194
prefix return an `Optional` object, which will be empty if the value is
195195
not present in the database. The method without the prefix will throw an
196196
`AddressNotFoundException` if the address is not in the database. If you
@@ -437,7 +437,8 @@ following:
437437

438438
* `com.maxmind.geoip2.record.City` - `City.getGeoNameId`
439439
* `com.maxmind.geoip2.record.Continent` - `Continent.getCode` or `Continent.getGeoNameId`
440-
* `com.maxmind.geoip2.record.Country` and `com.maxmind.geoip2.record.RepresentedCountry` - `Country.getIsoCode` or `Country.getGeoNameId`
440+
* `com.maxmind.geoip2.record.Country` and `com.maxmind.geoip2.record.RepresentedCountry` - `Country.getIsoCode`
441+
or `Country.getGeoNameId`
441442
* `com.maxmind.geoip2.record.Subdivision` - `Subdivision.getIsoCode` or `Subdivision.getGeoNameId`
442443

443444
## Multi-Threaded Use ##

sample/Benchmark.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,20 @@ public static void main(String[] args) throws GeoIp2Exception, IOException {
3131
loop("Benchmarking", file, BENCHMARKS, new CHMCache());
3232
}
3333

34-
private static void loop(String msg, File file, int loops, NodeCache cache) throws GeoIp2Exception, IOException {
34+
private static void loop(String msg, File file, int loops, NodeCache cache)
35+
throws GeoIp2Exception, IOException {
3536
System.out.println(msg);
3637
for (int i = 0; i < loops; i++) {
37-
DatabaseReader r = new DatabaseReader.Builder(file).fileMode(FileMode.MEMORY_MAPPED).withCache(cache).build();
38+
DatabaseReader r =
39+
new DatabaseReader.Builder(file).fileMode(FileMode.MEMORY_MAPPED).withCache(cache)
40+
.build();
3841
bench(r, COUNT, i);
3942
}
4043
System.out.println();
4144
}
4245

43-
private static void bench(DatabaseReader r, int count, int seed) throws GeoIp2Exception, UnknownHostException {
46+
private static void bench(DatabaseReader r, int count, int seed)
47+
throws GeoIp2Exception, UnknownHostException {
4448
Random random = new Random(seed);
4549
long startTime = System.nanoTime();
4650
byte[] address = new byte[4];

src/main/java/com/maxmind/geoip2/DatabaseProvider.java

Lines changed: 33 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
11
package com.maxmind.geoip2;
22

33
import com.maxmind.geoip2.exception.GeoIp2Exception;
4-
import com.maxmind.geoip2.model.*;
5-
4+
import com.maxmind.geoip2.model.AnonymousIpResponse;
5+
import com.maxmind.geoip2.model.AsnResponse;
6+
import com.maxmind.geoip2.model.CityResponse;
7+
import com.maxmind.geoip2.model.ConnectionTypeResponse;
8+
import com.maxmind.geoip2.model.CountryResponse;
9+
import com.maxmind.geoip2.model.DomainResponse;
10+
import com.maxmind.geoip2.model.EnterpriseResponse;
11+
import com.maxmind.geoip2.model.IpRiskResponse;
12+
import com.maxmind.geoip2.model.IspResponse;
613
import java.io.IOException;
714
import java.net.InetAddress;
815
import java.util.Optional;
@@ -16,7 +23,7 @@ public interface DatabaseProvider extends GeoIp2Provider {
1623
* @throws IOException if there is an IO error
1724
*/
1825
Optional<CountryResponse> tryCountry(InetAddress ipAddress) throws IOException,
19-
GeoIp2Exception;
26+
GeoIp2Exception;
2027

2128
/**
2229
* @param ipAddress IPv4 or IPv6 address to lookup.
@@ -25,7 +32,7 @@ Optional<CountryResponse> tryCountry(InetAddress ipAddress) throws IOException,
2532
* @throws IOException if there is an IO error
2633
*/
2734
Optional<CityResponse> tryCity(InetAddress ipAddress) throws IOException,
28-
GeoIp2Exception;
35+
GeoIp2Exception;
2936

3037
/**
3138
* Look up an IP address in a GeoIP2 Anonymous IP.
@@ -36,7 +43,7 @@ Optional<CityResponse> tryCity(InetAddress ipAddress) throws IOException,
3643
* @throws java.io.IOException if there is an IO error
3744
*/
3845
AnonymousIpResponse anonymousIp(InetAddress ipAddress) throws IOException,
39-
GeoIp2Exception;
46+
GeoIp2Exception;
4047

4148
/**
4249
* Look up an IP address in a GeoIP2 Anonymous IP.
@@ -47,10 +54,10 @@ AnonymousIpResponse anonymousIp(InetAddress ipAddress) throws IOException,
4754
* @throws java.io.IOException if there is an IO error
4855
*/
4956
Optional<AnonymousIpResponse> tryAnonymousIp(InetAddress ipAddress) throws IOException,
50-
GeoIp2Exception;
57+
GeoIp2Exception;
5158

5259

53-
/**
60+
/**
5461
* Look up an IP address in a GeoIP2 IP Risk database.
5562
*
5663
* @param ipAddress IPv4 or IPv6 address to lookup.
@@ -59,18 +66,18 @@ Optional<AnonymousIpResponse> tryAnonymousIp(InetAddress ipAddress) throws IOExc
5966
* @throws java.io.IOException if there is an IO error
6067
*/
6168
IpRiskResponse ipRisk(InetAddress ipAddress) throws IOException,
62-
GeoIp2Exception;
69+
GeoIp2Exception;
6370

6471
/**
65-
* Look up an IP address in a GeoIP2 IP Risk database.
66-
*
67-
* @param ipAddress IPv4 or IPv6 address to lookup.
68-
* @return an IPRiskResponse for the requested IP address or empty if the IP address is not in the DB.
69-
* @throws com.maxmind.geoip2.exception.GeoIp2Exception if there is an error looking up the IP
70-
* @throws java.io.IOException if there is an IO error
71-
*/
72+
* Look up an IP address in a GeoIP2 IP Risk database.
73+
*
74+
* @param ipAddress IPv4 or IPv6 address to lookup.
75+
* @return an IPRiskResponse for the requested IP address or empty if the IP address is not in the DB.
76+
* @throws com.maxmind.geoip2.exception.GeoIp2Exception if there is an error looking up the IP
77+
* @throws java.io.IOException if there is an IO error
78+
*/
7279
Optional<IpRiskResponse> tryIpRisk(InetAddress ipAddress) throws IOException,
73-
GeoIp2Exception;
80+
GeoIp2Exception;
7481

7582
/**
7683
* Look up an IP address in a GeoLite2 ASN database.
@@ -81,7 +88,7 @@ Optional<IpRiskResponse> tryIpRisk(InetAddress ipAddress) throws IOException,
8188
* @throws java.io.IOException if there is an IO error
8289
*/
8390
AsnResponse asn(InetAddress ipAddress) throws IOException,
84-
GeoIp2Exception;
91+
GeoIp2Exception;
8592

8693
/**
8794
* Look up an IP address in a GeoLite2 ASN database.
@@ -92,7 +99,7 @@ AsnResponse asn(InetAddress ipAddress) throws IOException,
9299
* @throws java.io.IOException if there is an IO error
93100
*/
94101
Optional<AsnResponse> tryAsn(InetAddress ipAddress) throws IOException,
95-
GeoIp2Exception;
102+
GeoIp2Exception;
96103

97104
/**
98105
* Look up an IP address in a GeoIP2 Connection Type database.
@@ -103,7 +110,7 @@ Optional<AsnResponse> tryAsn(InetAddress ipAddress) throws IOException,
103110
* @throws java.io.IOException if there is an IO error
104111
*/
105112
ConnectionTypeResponse connectionType(InetAddress ipAddress)
106-
throws IOException, GeoIp2Exception;
113+
throws IOException, GeoIp2Exception;
107114

108115
/**
109116
* Look up an IP address in a GeoIP2 Connection Type database.
@@ -114,7 +121,7 @@ ConnectionTypeResponse connectionType(InetAddress ipAddress)
114121
* @throws java.io.IOException if there is an IO error
115122
*/
116123
Optional<ConnectionTypeResponse> tryConnectionType(InetAddress ipAddress)
117-
throws IOException, GeoIp2Exception;
124+
throws IOException, GeoIp2Exception;
118125

119126
/**
120127
* Look up an IP address in a GeoIP2 Domain database.
@@ -125,7 +132,7 @@ Optional<ConnectionTypeResponse> tryConnectionType(InetAddress ipAddress)
125132
* @throws java.io.IOException if there is an IO error
126133
*/
127134
DomainResponse domain(InetAddress ipAddress) throws IOException,
128-
GeoIp2Exception;
135+
GeoIp2Exception;
129136

130137
/**
131138
* Look up an IP address in a GeoIP2 Domain database.
@@ -136,7 +143,7 @@ DomainResponse domain(InetAddress ipAddress) throws IOException,
136143
* @throws java.io.IOException if there is an IO error
137144
*/
138145
Optional<DomainResponse> tryDomain(InetAddress ipAddress) throws IOException,
139-
GeoIp2Exception;
146+
GeoIp2Exception;
140147

141148
/**
142149
* Look up an IP address in a GeoIP2 Enterprise database.
@@ -147,7 +154,7 @@ Optional<DomainResponse> tryDomain(InetAddress ipAddress) throws IOException,
147154
* @throws java.io.IOException if there is an IO error
148155
*/
149156
EnterpriseResponse enterprise(InetAddress ipAddress) throws IOException,
150-
GeoIp2Exception;
157+
GeoIp2Exception;
151158

152159
/**
153160
* Look up an IP address in a GeoIP2 Enterprise database.
@@ -158,7 +165,7 @@ EnterpriseResponse enterprise(InetAddress ipAddress) throws IOException,
158165
* @throws java.io.IOException if there is an IO error
159166
*/
160167
Optional<EnterpriseResponse> tryEnterprise(InetAddress ipAddress) throws IOException,
161-
GeoIp2Exception;
168+
GeoIp2Exception;
162169

163170
/**
164171
* Look up an IP address in a GeoIP2 ISP database.
@@ -169,7 +176,7 @@ Optional<EnterpriseResponse> tryEnterprise(InetAddress ipAddress) throws IOExcep
169176
* @throws java.io.IOException if there is an IO error
170177
*/
171178
IspResponse isp(InetAddress ipAddress) throws IOException,
172-
GeoIp2Exception;
179+
GeoIp2Exception;
173180

174181
/**
175182
* Look up an IP address in a GeoIP2 ISP database.
@@ -180,5 +187,5 @@ IspResponse isp(InetAddress ipAddress) throws IOException,
180187
* @throws java.io.IOException if there is an IO error
181188
*/
182189
Optional<IspResponse> tryIsp(InetAddress ipAddress) throws IOException,
183-
GeoIp2Exception;
190+
GeoIp2Exception;
184191
}

0 commit comments

Comments
 (0)