Class EncodeUtil

java.lang.Object
com.vaadin.flow.internal.EncodeUtil

public final class EncodeUtil extends Object
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 Details

    • rfc5987Encode

      public static String rfc5987Encode(String value)
      Encodes the given string to UTF-8 value-chars as defined in RFC5987 for use in e.g. the Content-Disposition HTTP header.
      Parameters:
      value - the string to encode, not null
      Returns:
      the encoded string
    • rfc2047Encode

      public static String rfc2047Encode(String value)
      Encodes the given header field param as defined in RFC 2047 for use in e.g. the Content-Disposition HTTP header.
      Parameters:
      value - the string to encode, not null
      Returns:
      the encoded string
      Since:
      24.8.7
    • quotedStringEscape

      public static String quotedStringEscape(String value)
      Escapes the given string for use as the content of a quoted-string as defined in RFC 9110, e.g. a filename parameter of the Content-Disposition HTTP header. Backslashes and double quotes are prefixed with a backslash. Control characters are removed, see removeControlCharacters(String). The surrounding double quotes are not added.
      Parameters:
      value - the string to escape, not null
      Returns:
      the escaped string
      Since:
      25.3.6
    • removeControlCharacters

      public static String removeControlCharacters(String value)
      Removes all ISO control characters, as defined by Character.isISOControl(char), from the given string, e.g. CR, LF and tab.
      Parameters:
      value - the string to clean, not null
      Returns:
      the string without control characters
      Since:
      25.3.6
    • isPureUSASCII

      public static boolean isPureUSASCII(String text)
      Checks if the given string contains only US-ASCII characters.
      Parameters:
      text - the string to check, not null
      Returns:
      true if the string contains only US-ASCII characters,
      Since:
      24.8.7