public class QQWry
extends java.lang.Object
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 myIP = "127.0.0.1";
IPZone ipzone = qqwry.findIP(myIP);
System.out.printf("%s, %s", ipzone.getMainInfo(), ipzone.getSubInfo());
// IANA, 保留地址用于本地回送
| Constructor and Description |
|---|
QQWry()
Create QQWry by loading qqwry.dat from classpath.
|
QQWry(byte[] data)
Create QQWry with provided qqwry.dat data.
|
QQWry(java.nio.file.Path file)
Create QQWry from a path to qqwry.dat file.
|
| Modifier and Type | Method and Description |
|---|---|
IPZone |
findIP(java.lang.String ip) |
public QQWry()
throws java.io.IOException
java.io.IOException - if encounter error while reading qqwry.datpublic QQWry(byte[] data)
data - fully read data from a qqwry.dat file.public QQWry(java.nio.file.Path file)
throws java.io.IOException
file - path to qqwry.datjava.io.IOException - if encounter error while reading from the given file.public IPZone findIP(java.lang.String ip)