Class Utf8
java.lang.Object
org.springframework.security.crypto.codec.Utf8
UTF-8 Charset encoder/decoder.
For internal use only.
-
Method Summary
Modifier and TypeMethodDescriptionstatic Stringdecode(byte[] bytes) Decode the bytes in UTF-8 form into a String.static byte[]encode(CharSequence string) Get the bytes of the String in UTF-8 encoded form.static booleanisEqual(@Nullable CharSequence expected, @Nullable CharSequence actual) Constant time comparison to prevent against timing attacks.
-
Method Details
-
encode
Get the bytes of the String in UTF-8 encoded form. -
decode
Decode the bytes in UTF-8 form into a String. -
isEqual
Constant time comparison to prevent against timing attacks.- Parameters:
expected- the expectedCharSequenceactual- the actualCharSequence- Returns:
- true if
expectedandactualare equal, false otherwise - Since:
- 5.7.26
-