public class SurtPrefixSet extends PrefixSet
| Constructor and Description |
|---|
SurtPrefixSet() |
| Modifier and Type | Method and Description |
|---|---|
void |
addFromPlain(java.lang.String u)
Given a plain URI or hostname, deduce an implied SURT prefix from
it and add to active prefixes.
|
static java.lang.String |
asPrefix(java.lang.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(java.lang.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 java.lang.String |
convertPrefixToDomain(java.lang.String prefix) |
static java.lang.String |
convertPrefixToHost(java.lang.String prefix) |
void |
exportTo(java.io.FileWriter fw) |
static java.lang.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(java.io.Reader r)
Read a set of SURT prefixes from a reader source; keep sorted and
with redundant entries removed.
|
void |
importFromMixed(java.io.Reader r,
boolean deduceFromSeeds)
Import SURT prefixes from a reader with mixed URI and SURT prefix
format.
|
void |
importFromUris(java.io.Reader r) |
static void |
main(java.lang.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 java.lang.String |
prefixFromPlainForceHttp(java.lang.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, spliterator, subSet, subSet, tailSet, tailSetaddAll, containsAll, retainAll, toArray, toArray, toStringfinalize, getClass, notify, notifyAll, wait, wait, waitpublic void importFrom(java.io.Reader r)
r - reader over file of SURT_format stringsjava.io.IOExceptionpublic void importFromUris(java.io.Reader r)
r - Where to read from.public void importFromMixed(java.io.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(java.lang.String suri)
suri - potential directivepublic void addFromPlain(java.lang.String u)
u - String of URI or hostnamepublic static java.lang.String prefixFromPlainForceHttp(java.lang.String u)
u - URI or almost-URI to considerpublic static java.lang.String asPrefix(java.lang.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 java.lang.String getCandidateSurt(UsableURI u)
object - CandidateURI or UURIpublic void exportTo(java.io.FileWriter fw)
throws java.io.IOException
fw - java.io.IOExceptionpublic void convertAllPrefixesToHosts()
public static java.lang.String convertPrefixToHost(java.lang.String prefix)
public void convertAllPrefixesToDomains()
public static java.lang.String convertPrefixToDomain(java.lang.String prefix)
public static void main(java.lang.String[] args)
throws java.io.IOException
args - cmd-line arguments: may include input filejava.io.IOExceptionCopyright © 2019 The International Internet Preservation Consortium. All Rights Reserved.