Package com.vaadin.flow.internal
Class EncodeUtil
java.lang.Object
com.vaadin.flow.internal.EncodeUtil
Utilities related to various encoding schemes.
For internal use only. May be renamed or removed in a future release.
- Since:
- 1.0
- Author:
- Vaadin Ltd
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleanisPureUSASCII(String text) Checks if the given string contains only US-ASCII characters.static StringquotedStringEscape(String value) Escapes the given string for use as the content of aquoted-stringas defined in RFC 9110, e.g. afilenameparameter of theContent-DispositionHTTP header.static StringremoveControlCharacters(String value) Removes all ISO control characters, as defined byCharacter.isISOControl(char), from the given string, e.g.static Stringrfc2047Encode(String value) Encodes the given header field param as defined in RFC 2047 for use in e.g. theContent-DispositionHTTP header.static Stringrfc5987Encode(String value) Encodes the given string to UTF-8value-charsas defined in RFC5987 for use in e.g. theContent-DispositionHTTP header.
-
Method Details
-
rfc5987Encode
Encodes the given string to UTF-8value-charsas defined in RFC5987 for use in e.g. theContent-DispositionHTTP header.- Parameters:
value- the string to encode, notnull- Returns:
- the encoded string
-
rfc2047Encode
Encodes the given header field param as defined in RFC 2047 for use in e.g. theContent-DispositionHTTP header.- Parameters:
value- the string to encode, notnull- Returns:
- the encoded string
- Since:
- 24.8.7
-
quotedStringEscape
Escapes the given string for use as the content of aquoted-stringas defined in RFC 9110, e.g. afilenameparameter of theContent-DispositionHTTP header. Backslashes and double quotes are prefixed with a backslash. Control characters are removed, seeremoveControlCharacters(String). The surrounding double quotes are not added.- Parameters:
value- the string to escape, notnull- Returns:
- the escaped string
- Since:
- 25.3.6
-
removeControlCharacters
Removes all ISO control characters, as defined byCharacter.isISOControl(char), from the given string, e.g. CR, LF and tab.- Parameters:
value- the string to clean, notnull- Returns:
- the string without control characters
- Since:
- 25.3.6
-
isPureUSASCII
Checks if the given string contains only US-ASCII characters.- Parameters:
text- the string to check, notnull- Returns:
trueif the string contains only US-ASCII characters,- Since:
- 24.8.7
-