public static final class DatabaseReader.Builder extends Object
Constructs a Builder for the DatabaseReader. The file passed to it must be a valid GeoIP2 database file.
Builder
creates instances of DatabaseReader
from values set by the methods.
Only the values set in the Builder
constructor are required.
Constructor and Description |
---|
Builder(File database) |
Builder(InputStream stream) |
Modifier and Type | Method and Description |
---|---|
DatabaseReader |
build() |
DatabaseReader.Builder |
fileMode(com.maxmind.db.Reader.FileMode val) |
DatabaseReader.Builder |
locales(List<String> val) |
public Builder(InputStream stream)
stream
- the stream containing the GeoIP2 database to use.public Builder(File database)
database
- the GeoIP2 database file to use.public DatabaseReader.Builder locales(List<String> val)
val
- List of locale codes to use in name property from most
preferred to least preferred.public DatabaseReader.Builder fileMode(com.maxmind.db.Reader.FileMode val)
val
- The file mode used to open the GeoIP2 databaseIllegalArgumentException
- if you initialized the Builder with a URL, which uses
Reader.FileMode.MEMORY
, but you provided a different
FileMode to this method.public DatabaseReader build() throws IOException
DatabaseReader
created from the
fields set on this builder.IOException
- if there is an error reading the databaseCopyright © 2014 MaxMind, Inc.. All Rights Reserved.