Example usage for org.apache.commons.net.whois WhoisClient query

List of usage examples for org.apache.commons.net.whois WhoisClient query

Introduction

In this page you can find the example usage for org.apache.commons.net.whois WhoisClient query.

Prototype

public String query(String handle) throws IOException 

Source Link

Document

Queries the connected whois server for information regarding the given handle.

Usage

From source file:org.oucho.whois.LookupWhoisTask.java

protected String doInBackground(String... urls) {
    String url = urls[0];//from  w  w  w .j a va 2  s  .c  om

    String[] parts = url.split("\\:");
    String adresse = parts[0];
    String host = parts[1];

    if ("whois.internic.net".equals(host))
        adresse = "=" + adresse;

    StringBuilder result = new StringBuilder("");

    WhoisClient whois = new WhoisClient();

    try {
        whois.connect(host);
        String whoisData1 = whois.query(adresse);
        result.append(whoisData1);
        whois.disconnect();
    } catch (SocketException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    }

    return result.toString();
}