java.lang.Object
de.cuioss.tools.net.IDNInternetAddress
Utility class to handle IDN email addresses.
See- Author:
- Matthias Walliczek
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringDecode the domain part of an email addressstatic Stringdecode(@NonNull String completeAddress, UnaryOperator<String> sanitizer) Decodes the given address and sanitizes the elements with the provided sanitizer.static StringEncode the domain part of an email addressstatic Stringencode(@NonNull String completeAddress, UnaryOperator<String> sanitizer) Encodes the given address and sanitizes the elements with the provided sanitizer.
-
Constructor Details
-
IDNInternetAddress
public IDNInternetAddress()
-
-
Method Details
-
encode
Encode the domain part of an email address- Parameters:
completeAddress- the address to encode in RFC822 format- Returns:
- the encoded address in RFC822 format
-
encode
public static String encode(@NonNull @NonNull String completeAddress, UnaryOperator<String> sanitizer) Encodes the given address and sanitizes the elements with the provided sanitizer. It takes care on the special elements like<>by not trying to sanitize them.- Parameters:
completeAddress-sanitizer- to be passed as UnaryOperator- Returns:
- the sanitized and encoded address.
-
decode
Decode the domain part of an email address- Parameters:
completeAddress- the address to decode in RFC822 format- Returns:
- the decoded address in RFC822 format
-
decode
public static String decode(@NonNull @NonNull String completeAddress, UnaryOperator<String> sanitizer) Decodes the given address and sanitizes the elements with the provided sanitizer. It takes care on the special elements like <> by not trying to sanitize them.- Parameters:
completeAddress-sanitizer- to be passed as UnaryOperator- Returns:
- the sanitized and decoded address.
-