程序包 online.xcodes.ip

类 QQWry

java.lang.Object
online.xcodes.ip.QQWry

public class QQWry extends Object
Thread safe. A QQWry instance can share amount threads.
 Usage: 
 QQWry qqwry = new QQWry(); // load qqwry.dat from classpath

 QQWry qqwry = new QQWry(Paths.get("path/to/qqwry.dat")); // load qqwry.dat from java.nio.file.Path

 byte[] data = Files.readAllBytes(Paths.get("path/to/qqwry.dat"));
 QQWry qqwry = new QQWry(data); // create QQWry with provided data

 String dbVer = qqwry.getDatabaseVersion();
 System.out.printf("qqwry.dat version=%s", dbVer);
 // qqwry.dat version=2020.9.10

 String myIP = "127.0.0.1";
 IPZone ipzone = qqwry.findIP(myIP);
 System.out.printf("%s, %s", ipzone.getMainInfo(), ipzone.getSubInfo());
 // IANA, 保留地址用于本地回送
 
 
作者:
Jarod Liu <liuyuanzhi@gmail.com>
  • 构造器详细资料

    • QQWry

      public QQWry() throws IOException
      Create QQWry by loading qqwry.dat from classpath.
      抛出:
      IOException - if encounter error while reading qqwry.dat
    • QQWry

      public QQWry(byte[] data)
      Create QQWry with provided qqwry.dat data.
      参数:
      data - fully read data from a qqwry.dat file.
    • QQWry

      public QQWry(Path file) throws IOException
      Create QQWry from a path to qqwry.dat file.
      参数:
      file - path to qqwry.dat
      抛出:
      IOException - if encounter error while reading from the given file.
  • 方法详细资料

    • findIP

      public online.xcodes.ip.QQWry.IPZone findIP(String ip)
    • getDatabaseVersion

      public String getDatabaseVersion()
      qqwry database version in pattern x.x.x