Class LinkHandlingUtilities

java.lang.Object
com.ibm.icu.impl.links.LinkHandlingUtilities

public class LinkHandlingUtilities extends Object
  • Field Details

    • SOFAR

      private static final UnicodeSet SOFAR
    • EMAIL_ASCII_INCLUDES

      static final UnicodeSet EMAIL_ASCII_INCLUDES
      These will be replaced once we have a real property value in ICU.
    • VALID_EMAIL_LOCAL_PART

      static final UnicodeSet VALID_EMAIL_LOCAL_PART
    • ESCAPED_BYTE_PATTERN

      private static final Pattern ESCAPED_BYTE_PATTERN
      Regex for percent escaping
    • ESCAPED_SINGLE

      private static final Pattern ESCAPED_SINGLE
  • Constructor Details

    • LinkHandlingUtilities

      public LinkHandlingUtilities()
  • Method Details

    • getOpening

      private static int getOpening(int cp)
      Defines the getOpening mapping
      It will be replaced once we have a real property value in ICU.
    • scanEmailBackwards

      public static int scanEmailBackwards(CharSequence source, int hardStart, int atSignPos)
    • joinListListEscaping

      private static String joinListListEscaping(String sep, String sep2, List<List<String>> partParts)
    • joinListEscaping

      private static String joinListEscaping(String sep, UnicodeSet toEscape, List<String> partParts)
    • cleanList

      private static List<List<String>> cleanList(LinkHandlingUtilities.Part part, String partString)
    • splitList

      private static List<String> splitList(LinkHandlingUtilities.Part part, String separator, String partString)
    • parsePathQueryFragment

      public static int parsePathQueryFragment(String source, int codePointOffset)
      Set lastSafe to 0 — this marks the last code point that is definitely included in the linkification.
      Set closingStack to empty
      Set the current code point position i to 0
      Loop from i = 0 to n
      Set LT to LinkTermination(cp[i])
      If LT == none, set lastSafe to be i+1, continue loop
      If LT == soft, continue loop
      If LT == hard, stop linkification and return lastSafe
      If LT == opening, push cp[i] onto closingStack
      If LT == closing, set open to the pop of closingStack, or 0 if the closingStack is empty
      If LinkPairedOpeners(cp[i]) == open, set lastSafe to be i+1, continue loop.
      Otherwise, stop linkification and return lastSafe
      If lastSafe == n+1, then the entire part is safe; continue to the next part
      Otherwise, stop linkification and return lastSafe
    • matches

      private static boolean matches(int[] codePoints, int cpIndex, int[] fragmentDirective)
      Simple utility for finding matching int array regions
    • appendCodePointsBetween

      private static void appendCodePointsBetween(StringBuilder output, int[] cp, int copyEnd, int notToCopy)
    • unescape

      private static String unescape(String stringWithEscapes)
      Unescape a string.
    • unescape

      private static String unescape(String stringWithEscapes, UnicodeSet toEscape)
      Unescape a string; however, code points in toEscape are escaped back.
    • appendPercentEscaped

      private static void appendPercentEscaped(StringBuilder output, int cp)
    • appendPercentEscaped

      private static void appendPercentEscaped(StringBuilder output, String source)
    • escape

      public static String escape(String source, UnicodeSet toEscape)
      percent-escape all the toEscape characters.
    • appendCheckingPercent

      private static void appendCheckingPercent(StringBuilder toAppendTo, String source, int lastEnd, int start)
      If we have in an unescaped string %xy, and xy are hex, then we have to escape the % sign.
    • percentUnescape

      private static String percentUnescape(String escapedSource)
      We are guaranteed that string is all percent escaped utf8, %a3%c0 ...
    • getInternals

      public static Map<String, List<List<String>>> getInternals(String source)