public final class DomainUtils extends Object
Modifier and Type | Field and Description |
---|---|
static String |
DOMAINNAME_CHAR_REGEX_STRING
Valid characters in a domain name, according to RFC3490.
|
Modifier and Type | Method and Description |
---|---|
static String |
domainNameFromHostname(String hostname)
Return a domain name.
|
static boolean |
isValidDomainName(String domainName)
Check if a given domainName is valid domain.
|
static String |
reduceHostname(String hostname)
Reduce a hostname to a more readable form.
|
public static final String DOMAINNAME_CHAR_REGEX_STRING
public static boolean isValidDomainName(String domainName)
domainName
- A name of a domain (netarkivet.dk)public static String domainNameFromHostname(String hostname)
E.g. if '.dk' and 'co.uk' are valid TLDs, www.netarchive.dk will be become netarchive.dk and news.bbc.co.uk will be come bbc.co.uk
hostname
- A hostname or IP address. Null hostname is not allowedpublic static String reduceHostname(String hostname) throws ArgumentNotValid
hostname
- A host name, should not be null.ArgumentNotValid
- if argument isn't valid.Copyright © 2005–2016 The Royal Danish Library, the Danish State and University Library, the National Library of France and the Austrian National Library.. All rights reserved.