org.icann.tld.util
Class DomainNameUtil

java.lang.Object
  extended by org.icann.tld.util.DomainNameUtil

public class DomainNameUtil
extends java.lang.Object

A utitility class to manipulate domain names

Version:
0.1
Author:
Simon Raveh

Constructor Summary
DomainNameUtil()
           
 
Method Summary
 java.lang.String getTopLevelDomain(java.lang.String domainName)
          Find the top level domain of a given domain name.
 java.lang.String stripLeadingDot(java.lang.String domainName)
          Strip the leading "." from a domain name.
 java.lang.String stripTrailingDot(java.lang.String domainName)
          Strip the trailing "." from a domain name.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DomainNameUtil

public DomainNameUtil()
Method Detail

getTopLevelDomain

public java.lang.String getTopLevelDomain(java.lang.String domainName)
Find the top level domain of a given domain name.

Parameters:
domainName - a fully qualified domain name
Returns:
return the top level domain for this domain name

stripLeadingDot

public java.lang.String stripLeadingDot(java.lang.String domainName)

Strip the leading "." from a domain name.

 DomainNameUtil.stripLeadingDot(.abc.com)  = abc.com
 DomainNameUtil.stripLeadingDot(.abc)  = abc
 DomainNameUtil.stripLeadingDot(abc)  = abc

Parameters:
domainName - the domain name to strip the dot from, may be null
Returns:
the domain name without the leading dot

stripTrailingDot

public java.lang.String stripTrailingDot(java.lang.String domainName)

Strip the trailing "." from a domain name.

 DomainNameUtil.stripLeadingDot(.abc.com.)  = .abc.com
 DomainNameUtil.stripLeadingDot(abc.)  = abc
 DomainNameUtil.stripLeadingDot(abc)  = abc

Parameters:
domainName - the domain name to strip the trailing dot from, may be null
Returns:
the domain name without the trailing dot


Copyright © 2006 ICANN. All Rights Reserved.