Skip to content

Commit 118cc54

Browse files
committed
Renamed Reader to MaxMindDbReader
1 parent 5ae56a6 commit 118cc54

File tree

5 files changed

+12
-12
lines changed

5 files changed

+12
-12
lines changed

sample/Benchmark.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@
66
import com.fasterxml.jackson.databind.JsonNode;
77
import com.google.common.net.InetAddresses;
88
import com.maxmind.maxminddb.InvalidDatabaseException;
9-
import com.maxmind.maxminddb.Reader;
10-
import com.maxmind.maxminddb.Reader.FileMode;
9+
import com.maxmind.maxminddb.MaxMindDbReader;
10+
import com.maxmind.maxminddb.MaxMindDbReader.FileMode;
1111

1212
public class Benchmark {
1313

1414
public static void main(String[] args) throws IOException,
1515
InvalidDatabaseException {
1616
File file = new File("GeoIP2-City.mmdb");
1717

18-
Reader r = new Reader(file, FileMode.MEMORY_MAPPED);
18+
MaxMindDbReader r = new MaxMindDbReader(file, FileMode.MEMORY_MAPPED);
1919
Random random = new Random();
2020
int count = 1000000;
2121
long startTime = System.nanoTime();

src/main/java/com/maxmind/maxminddb/Reader.java renamed to src/main/java/com/maxmind/maxminddb/MaxMindDbReader.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* Instances of this class provide a reader for the MaxMind DB format. IP
1313
* addresses can be looked up using the <code>get</code> method.
1414
*/
15-
public final class Reader implements Closeable {
15+
public final class MaxMindDbReader implements Closeable {
1616
private static final int DATA_SECTION_SEPARATOR_SIZE = 16;
1717
private static final byte[] METADATA_START_MARKER = { (byte) 0xAB,
1818
(byte) 0xCD, (byte) 0xEF, 'M', 'a', 'x', 'M', 'i', 'n', 'd', '.',
@@ -48,7 +48,7 @@ public enum FileMode {
4848
* @throws IOException
4949
* if there is an error opening or reading from the file.
5050
*/
51-
public Reader(File database) throws IOException {
51+
public MaxMindDbReader(File database) throws IOException {
5252
this(database, FileMode.MEMORY_MAPPED);
5353
}
5454

@@ -63,7 +63,7 @@ public Reader(File database) throws IOException {
6363
* @throws IOException
6464
* if there is an error opening or reading from the file.
6565
*/
66-
public Reader(File database, FileMode fileMode) throws IOException {
66+
public MaxMindDbReader(File database, FileMode fileMode) throws IOException {
6767
this.DEBUG = System.getenv().get("MAXMIND_DB_READER_DEBUG") != null;
6868
this.threadBuffer = new ThreadBuffer(database, fileMode);
6969

src/main/java/com/maxmind/maxminddb/ThreadBuffer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import java.nio.channels.FileChannel;
99
import java.nio.channels.FileChannel.MapMode;
1010

11-
import com.maxmind.maxminddb.Reader.FileMode;
11+
import com.maxmind.maxminddb.MaxMindDbReader.FileMode;
1212

1313
final class ThreadBuffer extends ThreadLocal<ByteBuffer> implements Closeable {
1414
// XXX - DO NOT PASS THIS OUTSIDE THIS CLASS.

src/test/java/com/maxmind/maxminddb/PointerTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
import com.fasterxml.jackson.databind.ObjectMapper;
1111
import com.fasterxml.jackson.databind.node.ObjectNode;
12-
import com.maxmind.maxminddb.Reader.FileMode;
12+
import com.maxmind.maxminddb.MaxMindDbReader.FileMode;
1313

1414
public class PointerTest {
1515
@SuppressWarnings("static-method")

src/test/java/com/maxmind/maxminddb/ReaderTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public void test() throws InvalidDatabaseException, IOException {
2323
for (int ipVersion : new int[] { 4, 6 }) {
2424
String fileName = "test-data/Test-IPv" + ipVersion + "-"
2525
+ recordSize + ".mmdb";
26-
Reader reader = new Reader(new File(fileName));
26+
MaxMindDbReader reader = new MaxMindDbReader(new File(fileName));
2727
this.testMetadata(reader, ipVersion, recordSize);
2828

2929
if (ipVersion == 4) {
@@ -36,7 +36,7 @@ public void test() throws InvalidDatabaseException, IOException {
3636
}
3737
}
3838

39-
private void testMetadata(Reader reader, int ipVersion, long recordSize) {
39+
private void testMetadata(MaxMindDbReader reader, int ipVersion, long recordSize) {
4040

4141
Metadata metadata = reader.getMetadata();
4242

@@ -56,7 +56,7 @@ private void testMetadata(Reader reader, int ipVersion, long recordSize) {
5656

5757
}
5858

59-
private void testIpV4(Reader reader, String fileName)
59+
private void testIpV4(MaxMindDbReader reader, String fileName)
6060
throws InvalidDatabaseException, IOException {
6161

6262
for (int i = 0; i <= 5; i++) {
@@ -92,7 +92,7 @@ private void testIpV4(Reader reader, String fileName)
9292
}
9393

9494
// XXX - logic could be combined with above
95-
private void testIpV6(Reader reader, String fileName)
95+
private void testIpV6(MaxMindDbReader reader, String fileName)
9696
throws InvalidDatabaseException, IOException {
9797
String[] subnets = new String[] { "::1:ffff:ffff", "::2:0:0",
9898
"::2:0:40", "::2:0:50", "::2:0:58" };

0 commit comments

Comments
 (0)