Class UXAddress


  • @Deprecated
    public class UXAddress
    extends Path
    Deprecated.
    not yet implemented
    Represents an RFC822 (and successors) eMail address header content, like Path, except the parser accepts more varying input, especially input by humans, and eventually will MIME-encode any nōn-ASCII characters. (For now they cause dropping the label part from the on-wire form.)
    Author:
    mirabilos (t.glaser@tarent.de)
    See Also:
    Path
    • Constructor Detail

      • UXAddress

        protected UXAddress​(String input)
        Deprecated.
        Private constructor. Use the factory method of(String) instead.
        Parameters:
        input - string to analyse
    • Method Detail

      • of

        public static UXAddress of​(String addresses)
        Deprecated.
        Creates and initialises a new (forgiving) parser for eMail addresses.
        Parameters:
        addresses - to parse
        Returns:
        null if addresses was null or very large, the new parser instance otherwise
        See Also:
        Path.of(String)
      • of

        protected static <T extends org.evolvis.tartools.rfc822.Parser> T of​(Class<T> cls,
                                                                             String input)

        Constructs a parser. Intended to be used by subclasses from static factory methods *only*; see Path.of(String) for an example.

        Type Parameters:
        T - subclass of Parser to construct
        Parameters:
        cls - subclass of Parser to construct
        input - user-provided String to parse
        Returns:
        null if input was null or too large, the new parser subclass instance otherwise
      • jmp

        protected final int jmp​(int pos)
        Jumps to a specified input character position, absolute jump.
        Parameters:
        pos - to jump to
        Returns:
        the codepoint at that position
        Throws:
        IndexOutOfBoundsException - if pos is not in or just past the input
      • bra

        protected final int bra​(int deltapos)
        Jumps to a specified input character position, relative jump.
        Parameters:
        deltapos - to add to the current position
        Returns:
        the codepoint at that position
        Throws:
        IndexOutOfBoundsException - if pos is not in or just past the input
      • pos

        protected final int pos()
        Returns the current input character position. Useful for saving and restoring (with jmp(int)) and for error messages.
        Returns:
        position
      • s

        protected final String s()
        Returns the input string, for use with substring comparisons. (This is safe because Java™ strings are immutable.)
        Returns:
        String input
      • cur

        protected final int cur()
        Returns the wide character at the current position.
        Returns:
        UCS-4 codepoint, or -1 if end of input is reached
      • peek

        protected final int peek()
        Returns the wide character after the one at the current position.
        Returns:
        UCS-4 codepoint, or -1 if end of input is reached
      • accept

        protected final int accept()
        Advances the current position to the next character.
        Returns:
        codepoint of the next character, or -1 if end of input is reached
        Throws:
        IndexOutOfBoundsException - if end of input was already reached
      • skipPeek

        protected final int skipPeek​(BiFunction<Integer,​Integer,​Boolean> matcher)
        Advances the current position using a peeking matcher. Continues as long as the matcher returns true and end of input is not yet reached.
        Parameters:
        matcher - gets called with cur() and peek() as arguments
        Returns:
        codepoint of the first character where the matcher returned false, or -1 if end of input is reached
        See Also:
        skip(Function)
      • skip

        protected final int skip​(Function<Integer,​Boolean> matcher)
        Advances the current position using a regular matcher. Continues as long as the matcher returns true and end of input is not yet reached.
        Parameters:
        matcher - gets called with just cur() as argument
        Returns:
        codepoint of the first character where the matcher returned false, or -1 if end of input is reached
        See Also:
        skipPeek(BiFunction)