Class LinkExtractor
java.lang.Object
org.nibor.autolink.LinkExtractor
Extracts links from input.
Create and configure an extractor using builder(), then call extractLinks(CharSequence).
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder for configuring link extractor.private classprivate class -
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateLinkExtractor(UrlScanner urlScanner, WwwScanner wwwScanner, EmailScanner emailScanner) -
Method Summary
Modifier and TypeMethodDescriptionstatic LinkExtractor.Builderbuilder()extractLinks(CharSequence input) Extract the links from the input text.extractSpans(CharSequence input) Extract spans from the input text.private Scannertrigger(char c)
-
Field Details
-
urlScanner
-
wwwScanner
-
emailScanner
-
-
Constructor Details
-
LinkExtractor
-
-
Method Details
-
builder
-
extractLinks
Extract the links from the input text. Can be called multiple times with different inputs (thread-safe).- Parameters:
input- the input text, must not be null- Returns:
- a lazy iterable for the links in order that they appear in the input, never null
- See Also:
-
extractSpans
Extract spans from the input text. A span is a substring of the input and represents either a link (seeLinkSpan) or plain text outside a link.Using this is more convenient than
extractLinks(CharSequence)if you want to transform the whole input text to a different format.- Parameters:
input- the input text, must not be null- Returns:
- a lazy iterable for the spans in order that they appear in the input, never null
-
trigger
-