public class SurtPrefixSet extends PrefixSet
| Constructor and Description |
|---|
SurtPrefixSet() |
| Modifier and Type | Method and Description |
|---|---|
void |
addFromPlain(String u)
Given a plain URI or hostname, deduce an implied SURT prefix from
it and add to active prefixes.
|
static String |
asPrefix(String s)
Utility method for truncating a SURT that came from a
full URI (as a seed, for example) into a prefix
for determining inclusion.
|
boolean |
considerAsAddDirective(String suri)
Interpret the given SURT/URI/host as a directive, returning true
if it was meaningful.
|
void |
convertAllPrefixesToDomains()
Changes all prefixes so that they only enforce a general
domain (allowing subdomains).For prefixes that don't include
a ')', no change is necessary.
|
void |
convertAllPrefixesToHosts()
Changes all prefixes so that they enforce an exact host.
|
static String |
convertPrefixToDomain(String prefix) |
static String |
convertPrefixToHost(String prefix) |
void |
exportTo(FileWriter fw) |
static String |
getCandidateSurt(UsableURI u)
Calculate the SURT form URI to use as a candidate against prefixes
from the given Object (CandidateURI or UURI)
|
void |
importFrom(Reader r)
Read a set of SURT prefixes from a reader source; keep sorted and
with redundant entries removed.
|
void |
importFromMixed(Reader r,
boolean deduceFromSeeds)
Import SURT prefixes from a reader with mixed URI and SURT prefix
format.
|
void |
importFromUris(Reader r) |
static void |
main(String[] args)
Allow class to be used as a command-line tool for converting
URL lists (or naked host or host/path fragments implied
to be HTTP URLs) to implied SURT prefix form.
|
static String |
prefixFromPlainForceHttp(String u)
Given a plain URI or hostname/hostname+path, deduce an implied SURT
prefix from it.
|
add, containsPrefixOfceiling, clear, clone, comparator, contains, descendingIterator, descendingSet, equals, first, floor, headSet, headSet, higher, isEmpty, iterator, last, lower, pollFirst, pollLast, remove, removeAll, size, subSet, subSet, tailSet, tailSethashCodeaddAll, containsAll, retainAll, toArray, toArray, toStringpublic void importFrom(Reader r)
r - reader over file of SURT_format stringsIOExceptionpublic void importFromUris(Reader r)
r - Where to read from.public void importFromMixed(Reader r, boolean deduceFromSeeds)
r - the reader to import the prefixes fromdeduceFromSeeds - true to also import SURT prefixes implied
from normal URIs/hostname seedspublic boolean considerAsAddDirective(String suri)
suri - potential directivepublic void addFromPlain(String u)
u - String of URI or hostnamepublic static String prefixFromPlainForceHttp(String u)
u - URI or almost-URI to considerpublic static String asPrefix(String s)
(1) removing the last path component, if any
(anything after the last '/', if there are
at least 3 '/'s)
(2) removing a trailing ')', if present, opening
the possibility of proper subdomains. (This
means that the presence or absence of a
trailing '/' after a hostname in a seed list
is significant for the how the SURT prefix is
created, even though it is not signficant for
the URI's treatment as a seed.)
s - String to work on.public static String getCandidateSurt(UsableURI u)
object - CandidateURI or UURIpublic void exportTo(FileWriter fw) throws IOException
fw - IOExceptionpublic void convertAllPrefixesToHosts()
public void convertAllPrefixesToDomains()
public static void main(String[] args) throws IOException
args - cmd-line arguments: may include input fileIOExceptionCopyright © 2015 The International Internet Preservation Consortium. All Rights Reserved.