Skip to content

Commit 8aafe10

Browse files
committed
Update README.md and CHANGELOG.md for network changes
1 parent a0bc361 commit 8aafe10

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ CHANGELOG
66

77
* IMPORTANT: Java 7 is now required. If you need Java 6 support, please
88
continue using 1.2.2 or earlier.
9+
* The method `getRecord` was added to `com.maxmind.db.Reader`. This method
10+
returns a `com.maxmind.db.Record` object that includes the data for the
11+
record as well as the network associated with the record.
912

1013
1.2.2 (2017-02-22)
1114
------------------

README.md

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,22 @@ read in metadata for the file.
6262

6363
```java
6464
File database = new File("/path/to/database/GeoIP2-City.mmdb");
65-
Reader reader = new Reader(database);
65+
try (Reader reader = new Reader(database)) {
6666

67-
InetAddress address = InetAddress.getByName("24.24.24.24");
67+
InetAddress address = InetAddress.getByName("24.24.24.24");
6868

69-
JsonNode response = reader.get(address);
69+
// get() returns just the data for the associated record
70+
JsonNode recordData = reader.get(address);
7071

71-
System.out.println(response);
72+
System.out.println(recordData);
7273

73-
reader.close();
74+
// getRecord() returns a Record class that contains both
75+
// the data for the record and associated metadata.
76+
Record record = reader.getRecord(address);
77+
78+
System.out.println(record.getData());
79+
System.out.println(record.getNetwork());
80+
}
7481
```
7582

7683
### Caching ###

0 commit comments

Comments
 (0)