java.lang.Object
com.maxmind.db.Metadata

public final class Metadataextends Object
Metadata for MaxMind database files. Contains information about database format, version, build epoch, type, languages, and various structural information about the database.
  • Field Details

    • binaryFormatMajorVersion

      private final int binaryFormatMajorVersion
      Major version of the database's binary format.
    • binaryFormatMinorVersion

      private final int binaryFormatMinorVersion
      Minor version of the database's binary format.
    • buildEpoch

      private final long buildEpoch
      When the database was built, seconds since 1970.
    • databaseType

      private final String databaseType
      The type name of the database.
    • description

      private final Map<String,String> description
      The database descriptions, by language.
    • ipVersion

      private final int ipVersion
      The IP version the database holds, 4 or 6.
    • languages

      private final List<String> languages
      The languages the descriptions are in.
    • nodeByteSize

      private final int nodeByteSize
      Bytes stored in one search tree node.
    • nodeCount

      private final int nodeCount
      Nodes in the search tree.
    • recordSize

      private final int recordSize
      Bits in one search tree record.
    • searchTreeSize

      private final int searchTreeSize
      Bytes 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

      private static int getInt(Object m, String key)
      Reads an integer field of the metadata map.
      Parameters:
      m - the metadata map
      key - the field name
      Returns:
      the field value
    • getLong

      private static long getLong(Object m, String key)
      Reads a long field of the metadata map.
      Parameters:
      m - the metadata map
      key - the field name
      Returns:
      the field value
    • getString

      private static String getString(Object m, String key)
      Reads a string field of the metadata map.
      Parameters:
      m - the metadata map
      key - the field name
      Returns:
      the field value
    • 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

      public Date getBuildDate()
      Gets the date the database was built.
      Returns:
      the date of the database build.
    • getDatabaseType

      public String 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

      public Map<String,String> getDescription()
      Gets the database description in each supported language.
      Returns:
      map from language code to description in that language.
    • 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

      public List<String> getLanguages()
      Gets the languages the database carries localized names in.
      Returns:
      list of languages supported by the database.
    • 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

      public String toString()
      Return a description of the database metadata, for diagnostics.
      Overrides:
      toString in class Object