public class EffectiveTldFinder extends Object
EffectiveTldFinder.getInstance()
.initialize(InputStream)
. Updates to the public suffix list can be found
here:
excludePrivate
to
getAssignedDomain(String, boolean, boolean)
resp.
getEffectiveTLD(String, boolean)
. This will
exclude the eTLDs from the PRIVATE domain section of the public suffix list
while a domain or eTLD is matched.Modifier and Type | Class and Description |
---|---|
static class |
EffectiveTldFinder.EffectiveTLD
EffectiveTLD objects hold one line of the public suffix list:
the suffix (
com , co.uk , etc.)
for IDN suffixes: both the ASCII and IDN variant
(xn--p1ai and рф )
and the properties required to parse host/domain names given in the
public suffix list (wildcard suffix, exception, in private domain
section)
|
Modifier and Type | Field and Description |
---|---|
static String |
COMMENT |
static char |
DOT |
static String |
DOT_REGEX |
static String |
ETLD_DATA |
static String |
EXCEPTION |
static int |
MAX_DOMAIN_LENGTH_PART
Max.
|
static String |
WILD_CARD |
Modifier and Type | Method and Description |
---|---|
static String |
getAssignedDomain(String hostname)
This method uses the effective TLD to determine which component of a FQDN
is the NIC-assigned domain name (aka "Paid Level Domain").
|
static String |
getAssignedDomain(String hostname,
boolean strict)
This method uses the effective TLD to determine which component of a FQDN
is the NIC-assigned domain name (aka "Paid Level Domain").
|
static String |
getAssignedDomain(String hostname,
boolean strict,
boolean excludePrivate)
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)
Get EffectiveTLD for host name using the singleton instance of
EffectiveTldFinder.
|
static EffectiveTldFinder.EffectiveTLD |
getEffectiveTLD(String hostname,
boolean excludePrivate)
Get EffectiveTLD for host name using the singleton instance of
EffectiveTldFinder.
|
static Map<String,EffectiveTldFinder.EffectiveTLD> |
getEffectiveTLDs() |
static EffectiveTldFinder |
getInstance()
Get singleton instance of EffectiveTldFinder with default configuration.
|
static void |
help() |
boolean |
initialize(InputStream effectiveTldDataStream)
(Re)initialize EffectiveTldFinder with custom public suffix list.
|
boolean |
isConfigured() |
static void |
main(String[] args) |
public static final String ETLD_DATA
public static final String COMMENT
public static final String DOT_REGEX
public static final String EXCEPTION
public static final String WILD_CARD
public static final char DOT
public static final int MAX_DOMAIN_LENGTH_PART
public static EffectiveTldFinder getInstance()
public boolean initialize(InputStream effectiveTldDataStream)
effectiveTldDataStream
- content of public suffix list as input streampublic static Map<String,EffectiveTldFinder.EffectiveTLD> getEffectiveTLDs()
public static EffectiveTldFinder.EffectiveTLD getEffectiveTLD(String hostname)
hostname
- the hostname for which to find the EffectiveTldFinder.EffectiveTLD
EffectiveTldFinder.EffectiveTLD
public static EffectiveTldFinder.EffectiveTLD getEffectiveTLD(String hostname, boolean excludePrivate)
hostname
- the hostname for which to find the EffectiveTldFinder.EffectiveTLD
excludePrivate
- do not return an effective TLD from the PRIVATE section,
instead return the shorter eTLD not in the PRIVATE sectionEffectiveTldFinder.EffectiveTLD
public static String getAssignedDomain(String hostname)
hostname
- a string for which to obtain a NIC-assigned domain namepublic static String getAssignedDomain(String hostname, boolean strict)
hostname
- a string for which to obtain a NIC-assigned domain namestrict
- do not return the hostname as fall-back if a FQDN with valid
TLD cannot be determinedpublic static String getAssignedDomain(String hostname, boolean strict, boolean excludePrivate)
hostname
- a string for which to obtain a NIC-assigned domain namestrict
- do not return the hostname as fall-back if a FQDN with valid
TLD cannot be determinedexcludePrivate
- do not return a domain which is below an eTLD from the PRIVATE
section, return the shorter domain which is below the
"ICANN" registry suffixpublic boolean isConfigured()
public static void help()
public static void main(String[] args) throws IOException
IOException
Copyright © 2009–2021 Crawler-Commons. All rights reserved.