Android Open Source - AndroidIPQQWry Q Q Wry And






From Project

Back to project page AndroidIPQQWry.

License

The source code is released under:

Apache License

If you think the Android project AndroidIPQQWry listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.hu.qqwryand;
/*w  ww .  j  a v  a  2 s  .c o  m*/
import java.io.UnsupportedEncodingException;

/**
 * QQWryAnd????????????????jni???
 * @author HZY
 *
 */
public class QQWryAnd {

  /**
   * ??????
   * @param datPath dat?????????
   */
  public QQWryAnd(String datPath) {
    this.jniOpen(datPath);
  }

  /**
   * 
   * @return QQwry?????
   */
  public String getVersion() {
    return getStr(jniGetVersionBytes());
  }

  /**
   * ???IP???
   * @param ip String?????IP???????????"192.168.56.1"
   * @return ip?????????
   */
  public String getIpAddr(String ip) {
    return getStr(jniGetIpAddrBytes(ip));
  }

  /**
   * ???IP??????
   * @param ip
   * @return ??????IP?????????
   */
  public String getIpRange(String ip) {
    return getStr(jniGetIpRangeBytes(ip));
  }
  
  /**
   * ???IP??????
   * @return
   */
  public int getIpCount(){
    return jniGetIpCount();
  }

  /**
   * ???jni???
   */
  public void close() {
    this.jniClose();
  }
  
  /**
   * ??byte??????????????
   * @param array
   * @return
   */
  private String getStr(byte[] array){  //??byte????GBK????????String
    String str = "";
    try {
      str = new String(array, "GBK");
    } catch (UnsupportedEncodingException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
    return str;
  }

  private native void jniOpen(String datPath);

  private native byte[] jniGetVersionBytes();

  private native byte[] jniGetIpAddrBytes(String ip);

  private native byte[] jniGetIpRangeBytes(String ip);

  private native int jniGetIpCount();
  
  private native void jniClose();

  static {
    System.loadLibrary("qqand");
  }

}




Java Source Code List

com.hu.qqwryand.Consts.java
com.hu.qqwryand.MainActivity.java
com.hu.qqwryand.PrepareFile.java
com.hu.qqwryand.QQWryAnd.java