# EffectiveTldFinder (Crawler-commons 0.7 API)
Date: 2016-11-21

crawlercommons.domains

## Class EffectiveTldFinder

- java.lang.Object
- - crawlercommons.domains.EffectiveTldFinder

    public class EffectiveTldFinder
    extends Object

Given a URL's hostname, there are determining the actual domain requires knowledge of the various domain registrars and their assignment policies. The best publicly available knowledge of this is maintained by the Mozilla developers; this class uses their data file format. For more information, see

- Effective TLD Service
- Public Suffix
- effective_tld_names

This class just needs "effective_tld_names.dat" in the classpath. If you want to configure it with other data, call EffectiveTldFinder.getInstance.initialize(is) and have at it.

### Nested Class Summary

Nested Classes
`static class` `EffectiveTldFinder.EffectiveTLD`

### Field Summary

Fields
`static String` `COMMENT`
`static char` `DOT`
`static String` `DOT_REGEX`
`static String` `ETLD_DATA`
`static String` `EXCEPTION`
`static String` `WILD_CARD`

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`static String` `getAssignedDomain(String hostname)` This method uses the effective TLD to determine which component of a FQDN is the NIC-assigned domain name.
`static EffectiveTldFinder.EffectiveTLD` `getEffectiveTLD(String hostname)`
`static Map<String,EffectiveTldFinder.EffectiveTLD>` `getEffectiveTLDs()`
`static EffectiveTldFinder` `getInstance()`
`boolean` `initialize(InputStream effectiveTldDataStream)`
`boolean` `isConfigured()`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### ETLD_DATA

    public static final String ETLD_DATA

See Also:
  Constant Field Values

#### COMMENT

    public static final String COMMENT

See Also:
  Constant Field Values

#### DOT_REGEX

    public static final String DOT_REGEX

See Also:
  Constant Field Values

#### EXCEPTION

    public static final String EXCEPTION

See Also:
  Constant Field Values

#### WILD_CARD

    public static final String WILD_CARD

See Also:
  Constant Field Values

#### DOT

    public static final char DOT

See Also:
  Constant Field Values

### Method Detail

#### getInstance

    public static EffectiveTldFinder getInstance()

#### initialize

    public boolean initialize(InputStream effectiveTldDataStream)

#### getEffectiveTLDs

    public static Map<String,EffectiveTldFinder.EffectiveTLD> getEffectiveTLDs()

#### getEffectiveTLD

    public static EffectiveTldFinder.EffectiveTLD getEffectiveTLD(String hostname)

Parameters:
  `hostname` - the hostname for which to find the `EffectiveTldFinder.EffectiveTLD`
Returns:
  the `EffectiveTldFinder.EffectiveTLD`

#### getAssignedDomain

    public static String getAssignedDomain(String hostname)

This method uses the effective TLD to determine which component of a FQDN is the NIC-assigned domain name.

Parameters:
  `hostname` - a string for which to obtain a NIC-assigned domain name
Returns:
  the NIC-assigned domain name

#### isConfigured

    public boolean isConfigured()