java.lang.Object
com.maxmind.db.Metadata
Metadata for MaxMind database files. Contains information about database format, version, build epoch, type, languages, and various structural information about the database.
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final intMajor version of the database's binary format.private final intMinor version of the database's binary format.private final longWhen the database was built, seconds since 1970.private final StringThe type name of the database.The database descriptions, by language.private final intThe IP version the database holds, 4 or 6.The languages the descriptions are in.private final intBytes stored in one search tree node.private final intNodes in the search tree.private final intBits in one search tree record.private final intBytes of the search tree in the file.Constructor Summary
Method Summary
Modifier and TypeMethodDescriptionintGets the major version of the database's binary format.intGets the minor version of the database's binary format.Gets the date the database was built.Gets the structure of the data records associated with an IP address.Gets the database description in each supported language.private static intReads an integer field of the metadata map.intGets the IP version the database holds address data for.Gets the languages the database carries localized names in.private static longReads a long field of the metadata map.(package private) intGets the size in bytes of one search tree node.(package private) intGets the number of nodes in the search tree.(package private) intGets the number of bits in one search tree record.(package private) intGets the total size in bytes of the search tree.private static StringReads a string field of the metadata map.toString()Return a description of the database metadata, for diagnostics.
Field Details
binaryFormatMajorVersion
private final int binaryFormatMajorVersionMajor version of the database's binary format.binaryFormatMinorVersion
private final int binaryFormatMinorVersionMinor version of the database's binary format.buildEpoch
private final long buildEpochWhen the database was built, seconds since 1970.databaseType
The type name of the database.description
ipVersion
private final int ipVersionThe IP version the database holds, 4 or 6.languages
nodeByteSize
private final int nodeByteSizeBytes stored in one search tree node.nodeCount
private final int nodeCountNodes in the search tree.recordSize
private final int recordSizeBits in one search tree record.searchTreeSize
private final int searchTreeSizeBytes of the search tree in the file.
Constructor Details
Metadata
Metadata(Map metadata) Create Metadata from decoded map- Parameters:
metadata- the decoded metadata map keyed by field name, for example "build_epoch"
Method Details
getInt
getLong
getString
getBinaryFormatMajorVersion
public int getBinaryFormatMajorVersion()Gets the major version of the database's binary format.- Returns:
- the major version number for the database's binary format.
getBinaryFormatMinorVersion
public int getBinaryFormatMinorVersion()Gets the minor version of the database's binary format.- Returns:
- the minor version number for the database's binary format.
getBuildDate
Gets the date the database was built.- Returns:
- the date of the database build.
getDatabaseType
Gets the structure of the data records associated with an IP address. The actual definition of these structures is left up to the database creator.- Returns:
- a string that indicates the structure of each data record
getDescription
getIpVersion
public int getIpVersion()Gets the IP version the database holds address data for.- Returns:
- whether the database contains IPv4 or IPv6 address data. The only possible values are 4 and 6.
getLanguages
getNodeByteSize
int getNodeByteSize()Gets the size in bytes of one search tree node.- Returns:
- the size in bytes of a single search tree node
getNodeCount
int getNodeCount()Gets the number of nodes in the search tree.- Returns:
- the number of nodes in the search tree.
getRecordSize
int getRecordSize()Gets the number of bits in one search tree record. Note that each node consists of two records.- Returns:
- the number of bits in a record in the search tree. Note that each node consists of two records.
getSearchTreeSize
int getSearchTreeSize()Gets the total size in bytes of the search tree.- Returns:
- the size in bytes of the whole search tree
toString