Class InternetMailAddressParser

java.lang.Object
de.uplanet.util.InternetMailAddressParser

@Scriptable public final class InternetMailAddressParser extends Object
A parser that extracts internet mail addresses from arbitrary text.

The supported address syntax is a subset of the address syntax defined in RFC 5322 and optionally RFC 6532.

  Restricted RFC 5322 address syntax recognized by this parser:

     addr-spec       =   local-part "@" domain

     local-part      =   dot-atom

     domain          =   dot-atom

     dot-atom-text   =   1*atext *("." 1*atext)

     dot-atom        =   [CFWS] dot-atom-text [CFWS]

     atext           =   ALPHA / DIGIT /    ; Printable US-ASCII
                         "!" / "#" /        ;  characters not including
                         "$" / "%" /        ;  specials.  Used for atoms.
                         "&" / "'" /
                         "*" / "+" /
                         "-" / "/" /
                         "=" / "?" /
                         "^" / "_" /
                         "`" / "{" /
                         "|" / "}" /
                         "~"
 
Under the rules of RFC 6532 the following extended production rules apply:
     atext           =/  UTF8-non-ascii

     UTF8-non-ascii  =   UTF8-2 / UTF8-3 / UTF8-4

     UTF8-2          =   <Defined in Section 4 of RFC3629>

     UTF8-3          =   <Defined in Section 4 of RFC3629>

     UTF8-4          =   <Defined in Section 4 of RFC3629>
 

  • Constructor Details

    • InternetMailAddressParser

      public InternetMailAddressParser()
      Create a mail address parser that supports internationalized email addresses and a maximum address length of 320 characters.
    • InternetMailAddressParser

      public InternetMailAddressParser(int p_iMaxAddressLength)
      Create a mail address parser that supports internationalized email addresses.
      Parameters:
      p_iMaxAddressLength - The maximum address length in characters.
    • InternetMailAddressParser

      public InternetMailAddressParser(boolean p_bInternationalized, int p_iMaxAddressLength)
      Create a mail address parser.
      Parameters:
      p_bInternationalized - true if internationalized email addresses should be supported, or false otherwise.
      p_iMaxAddressLength - The maximum address length in characters.
  • Method Details

    • hasAddresses

      public boolean hasAddresses()
    • getAddresses

      public List<String> getAddresses()
    • reset

      public void reset()
    • update

      public void update(CharSequence p_chseq)
    • update

      public void update(CharSequence p_chseq, int p_iStart, int p_iLen)
    • update

      public void update(char[] p_buf)
    • update

      public void update(char[] p_buf, int p_iStart, int p_iLen)
    • finish

      public void finish(CharSequence p_chseq)
    • finish

      public void finish(CharSequence p_chseq, int p_iStart, int p_iLen)
    • finish

      public void finish(char[] p_buf)
    • finish

      public void finish(char[] p_buf, int p_iStart, int p_iLen)