Class Utf8

java.lang.Object
org.springframework.security.crypto.codec.Utf8

public final class Utf8 extends Object
UTF-8 Charset encoder/decoder.

For internal use only.

  • Method Details

    • encode

      public static byte[] encode(CharSequence string)
      Get the bytes of the String in UTF-8 encoded form.
    • decode

      public static String decode(byte[] bytes)
      Decode the bytes in UTF-8 form into a String.
    • isEqual

      public static boolean isEqual(@Nullable CharSequence expected, @Nullable CharSequence actual)
      Constant time comparison to prevent against timing attacks.
      Parameters:
      expected - the expected CharSequence
      actual - the actual CharSequence
      Returns:
      true if expected and actual are equal, false otherwise
      Since:
      5.7.26