public final class Reader extends Object implements Closeable
get
method.Modifier and Type | Class and Description |
---|---|
static class |
Reader.FileMode
The file mode to use when opening a MaxMind DB.
|
Constructor and Description |
---|
Reader(File database)
Constructs a Reader for the MaxMind DB format.
|
Reader(File database,
Reader.FileMode fileMode)
Constructs a Reader for the MaxMind DB format.
|
Reader(InputStream source)
Constructs a Reader as if in mode
Reader.FileMode.MEMORY , without using
a File instance. |
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the MaxMind DB and returns resources to the system.
|
com.fasterxml.jackson.databind.JsonNode |
get(InetAddress ipAddress)
Looks up the
address in the MaxMind DB. |
Metadata |
getMetadata() |
public Reader(File database) throws IOException
database
- the MaxMind DB file to use.IOException
- if there is an error opening or reading from the file.public Reader(InputStream source) throws IOException
Reader.FileMode.MEMORY
, without using
a File
instance.source
- the InputStream that contains the MaxMind DB file.IOException
- if there is an error reading from the Stream.public Reader(File database, Reader.FileMode fileMode) throws IOException
database
- the MaxMind DB file to use.fileMode
- the mode to open the file with.IOException
- if there is an error opening or reading from the file.public com.fasterxml.jackson.databind.JsonNode get(InetAddress ipAddress) throws IOException
address
in the MaxMind DB.ipAddress
- the IP address to look up.IOException
- if a file I/O error occurs.public Metadata getMetadata()
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
- if an I/O error occurs.Copyright © 2015 MaxMind, Inc.. All rights reserved.