Class QQWry


  • public class QQWry
    extends java.lang.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 myIP = "127.0.0.1";
     IPZone ipzone = qqwry.findIP(myIP);
     System.out.printf("%s, %s", ipzone.getMainInfo(), ipzone.getSubInfo());
     // IANA, 保留地址用于本地回送
     
     
    • Constructor Summary

      Constructors 
      Constructor 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.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      IPZone findIP​(java.lang.String ip)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • QQWry

        public QQWry()
              throws java.io.IOException
        Create QQWry by loading qqwry.dat from classpath.
        Throws:
        java.io.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

        public QQWry​(java.nio.file.Path file)
              throws java.io.IOException
        Create QQWry from a path to qqwry.dat file.
        Parameters:
        file - path to qqwry.dat
        Throws:
        java.io.IOException - if encounter error while reading from the given file.
    • Method Detail

      • findIP

        public IPZone findIP​(java.lang.String ip)