android-components / mozilla.components.lib.publicsuffixlist / PublicSuffixList


class PublicSuffixList (source)

API for reading and accessing the public suffix list.

A “public suffix” is one under which Internet users can (or historically could) directly register names. Some examples of public suffixes are .com, and The Public Suffix List is a list of all known public suffixes.

Note that this implementation applies the rules of the public suffix list only and does not validate domains.


Name Summary
<init> PublicSuffixList(context: <ERROR CLASS>, dispatcher: CoroutineDispatcher = Dispatchers.IO, scope: CoroutineScope = CoroutineScope(dispatcher))
API for reading and accessing the public suffix list.


Name Summary
getPublicSuffix fun getPublicSuffix(domain: String): <ERROR CLASS>
Returns the public suffix of the given domain; known as the effective top-level domain (eTLD). Returns null if the domain is a public suffix itself.
getPublicSuffixPlusOne fun getPublicSuffixPlusOne(domain: String): Deferred<String?>
Returns the public suffix and one more level; known as the registrable domain. Returns null if domain is a public suffix itself.
isPublicSuffix fun isPublicSuffix(domain: String): Deferred<Boolean>
Returns true if the given domain is a public suffix; false otherwise.
prefetch fun prefetch(): Deferred<Unit>
Prefetch the public suffix list from disk so that it is available in memory.
stripPublicSuffix fun stripPublicSuffix(domain: String): <ERROR CLASS>
Strips the public suffix from the given domain. Returns the original domain if no public suffix could be stripped.