Package com.github.jarod.qqwry
Class QQWry
java.lang.Object
com.github.jarod.qqwry.QQWry
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, 保留地址用于本地回送
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionqqwry database version in pattern x.x.x
-
Constructor Details
-
QQWry
Create QQWry by loading qqwry.dat from classpath.- Throws:
IOException
- if encounter error while reading qqwry.dat
-
QQWry
public QQWry(byte[] data) Create QQWry with provided qqwry.dat data.- Parameters:
data
- fully read data from a qqwry.dat file.
-
QQWry
Create QQWry from a path to qqwry.dat file.- Parameters:
file
- path to qqwry.dat- Throws:
IOException
- if encounter error while reading from the given file.
-
-
Method Details
-
findIP
-
getDatabaseVersion
qqwry database version in pattern x.x.x
-