Class WwwScanner

  • All Implemented Interfaces:
    Scanner

    public class WwwScanner
    extends java.lang.Object
    implements Scanner
    Scan for WWW addresses such as "www.example.org" starting from the trigger character "w". Requires "www." at the beginning and an additional dot in the domain.

    Based on RFC 3986.

    • Constructor Summary

      Constructors 
      Constructor Description
      WwwScanner()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private static int findFirst​(java.lang.CharSequence input, int beginIndex, int rewindIndex)  
      private static int findLast​(java.lang.CharSequence input, int beginIndex)  
      private static boolean isAllowed​(char c)  
      private static boolean isWww​(java.lang.CharSequence input, int triggerIndex)  
      LinkSpan scan​(java.lang.CharSequence input, int triggerIndex, int rewindIndex)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • WwwScanner

        public WwwScanner()
    • Method Detail

      • scan

        public LinkSpan scan​(java.lang.CharSequence input,
                             int triggerIndex,
                             int rewindIndex)
        Specified by:
        scan in interface Scanner
        Parameters:
        input - input text
        triggerIndex - the index at which the trigger character for this scanner was
        rewindIndex - the index that can maximally be rewound to (either the very first character of the input or the character after the last matched link) need to be set to be set here
        Returns:
        the matched link, or null if no link matched
      • findFirst

        private static int findFirst​(java.lang.CharSequence input,
                                     int beginIndex,
                                     int rewindIndex)
      • findLast

        private static int findLast​(java.lang.CharSequence input,
                                    int beginIndex)
      • isAllowed

        private static boolean isAllowed​(char c)
      • isWww

        private static boolean isWww​(java.lang.CharSequence input,
                                     int triggerIndex)