@ThreadSafe public class WhoisApi extends Object
Example:
WhoisApi whoisApi = new WhoisApi("apiKey);
System.out.println(whoisApi.isAvailable("example.net") ? "available" : "registered");
Constructor and Description |
---|
WhoisApi(String apiKey)
Builds the Whois API client.
|
WhoisApi(String apiKey,
URI baseUri)
Builds the Whois API client.
|
Modifier and Type | Method and Description |
---|---|
CheckResult |
check(String domain)
Checks if a domain is available and returns the whois response.
|
Collection<String> |
domains()
Returns a list of all top and second level domains, which are known to
the Whois API.
|
boolean |
isAvailable(String domain)
Checks if a domain is available.
|
InputStream |
query(String host,
String query)
Queries a whois server.
|
String |
whois(String domain)
Returns the whois data for a domain.
|
public WhoisApi(String apiKey)
apiKey
- api keypublic CheckResult check(String domain) throws RecoverableWhoisApiException
domain
- domain name, e.g. "example.net"WhoisApiException
- if the api request caused an errorRecoverableWhoisApiException
- if the API failed, but you can try again.public boolean isAvailable(String domain) throws RecoverableWhoisApiException
domain
- domain name, e.g. "example.net"WhoisApiException
- if the api request caused an errorRecoverableWhoisApiException
- if the API failed, but you can try again.public String whois(String domain) throws RecoverableWhoisApiException
domain
- domain name, e.g. "example.net"WhoisApiException
- if the api request caused an errorRecoverableWhoisApiException
- if the API failed, but you can try again.public InputStream query(String host, String query) throws RecoverableWhoisApiException
host
- hostname of the whois server, e.g. "whois.verisign-grs.com"query
- query, e.g. "example.net"WhoisApiException
- if the api request caused an errorRecoverableWhoisApiException
- if the API failed, but you can try again.public Collection<String> domains() throws RecoverableWhoisApiException
RecoverableWhoisApiException
- if the API failed, but you can try again.Copyright © 2016. All rights reserved.