Package crawlercommons.domains
Class EffectiveTldFinder.EffectiveTLD
- java.lang.Object
-
- crawlercommons.domains.EffectiveTldFinder.EffectiveTLD
-
- Enclosing class:
- EffectiveTldFinder
public static class EffectiveTldFinder.EffectiveTLD extends Object
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:
- whether it's a wildcard suffix (
*.kawasaki.jp
), - or an exception to a wildcard rule
(
!city.kawasaki.jp
, - or whether the suffix is in the private domain section
- whether it's a wildcard suffix (
- for Internationalized Domain Names (IDNs) both the Unicode and ASCII representation
EffectiveTldFinder.getEffectiveTLD(String, boolean)
. A match result also includes the literally matched suffix which is distinct from the public suffix in case of wildcard suffixes or, eventually, for Internationalized Domain Names (IDNs).
-
-
Constructor Summary
Constructors Constructor Description EffectiveTLD(String line, boolean isPrivateDomain)
Parse one non-empty, non-comment line in the public suffix list and hold the public suffix and its properties in the created object.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description String
getDomain()
Set<String>
getNameVariants()
Generate name variants caused by Internationalized Domain Names: every IDN part of a eTLD can be replaced by its punycoded ASCII variant.String
getSuffix()
String
getUnicodeDomain()
boolean
isException()
boolean
isWild()
Deprecated.since 1.6 - replaced byisWildcard()
boolean
isWildcard()
String
toString()
-
-
-
Constructor Detail
-
EffectiveTLD
public EffectiveTLD(String line, boolean isPrivateDomain) throws IllegalArgumentException
Parse one non-empty, non-comment line in the public suffix list and hold the public suffix and its properties in the created object.- Parameters:
line
- non-empty, non-comment line in the public suffix listisPrivateDomain
- whether line is in the section of "PRIVATE DOMAINS" of the public suffix list- Throws:
IllegalArgumentException
- if the input line contains non-ASCII Unicode characters prohibited in IDNs, cf.IDN.toASCII(String)
-
-
Method Detail
-
getNameVariants
public Set<String> getNameVariants()
Generate name variants caused by Internationalized Domain Names: every IDN part of a eTLD can be replaced by its punycoded ASCII variant. For two-part IDN eTLDs this will generate 4 variants.- Returns:
- set of variant names
-
getDomain
public String getDomain()
- Returns:
- the public suffix (effective TLD) or for match results
returned by
EffectiveTldFinder.getEffectiveTLD(String, boolean)
the literally matched suffix which can be different from the suffix string in the public suffix list in case of wildcard or Unicode (IDN) suffixes. - See Also:
getSuffix()
,getUnicodeDomain()
-
getSuffix
public String getSuffix()
- Returns:
- the public suffix string from the public suffix list, for Unicode suffixes the ASCII (Punycode) representation
-
getUnicodeDomain
public String getUnicodeDomain()
- Returns:
- the Unicode version of a public suffix or
null
if it's not an IDN suffix
-
isWild
@Deprecated public boolean isWild()
Deprecated.since 1.6 - replaced byisWildcard()
- Returns:
- true if the public suffix (effective TLD) is a wildcard
suffix (e.g.,
*.kawasaki.jp
)
-
isWildcard
public boolean isWildcard()
- Returns:
- true if the public suffix (effective TLD) is a wildcard
suffix (e.g.,
*.kawasaki.jp
)
-
isException
public boolean isException()
- Returns:
- true if the public suffix (effective TLD) is an exception to
a wildcard suffix (e.g.,
!city.kawasaki.jp
)
-
-