Top Description Constructors Methods
org.springframework.util

public abstract Class Base64Utils

extends Object
Class Inheritance
Annotations
@Deprecated
since:6.0.5
forRemoval:true
Imports
java.util.Base64

Deprecated

for removal since 6.0.5.

as of Spring Framework 6.0.5 in favor of Base64; scheduled for removal in 6.2

A simple utility class for Base64 encoding and decoding.

Adapts to Java 8's java.util.Base64 in a convenience fashion.

Authors
Juergen Hoeller, Gary Russell
Since
4.1
See Also
java.util.Base64

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static byte[]

Returns:

the original byte array
decode
(byte[]
the encoded byte array
src
)

Base64-decode the given byte array.

public static byte[]

Returns:

the original byte array
decodeFromString
(String
the encoded UTF-8 String
src
)

Base64-decode the given byte array from a UTF-8 String.

public static byte[]

Returns:

the original byte array
decodeFromUrlSafeString
(String
the encoded UTF-8 String
src
)

Base64-decode the given byte array from a UTF-8 String using the RFC 4648 "URL and Filename Safe Alphabet".

public static byte[]

Returns:

the original byte array
decodeUrlSafe
(byte[]
the encoded byte array
src
)

Base64-decode the given byte array using the RFC 4648 "URL and Filename Safe Alphabet".

public static byte[]

Returns:

the encoded byte array
encode
(byte[]
the original byte array
src
)

Base64-encode the given byte array.

public static String

Returns:

the encoded byte array as a UTF-8 String
encodeToString
(byte[]
the original byte array
src
)

Base64-encode the given byte array to a String.

public static String

Returns:

the encoded byte array as a UTF-8 String
encodeToUrlSafeString
(byte[]
the original byte array
src
)

Base64-encode the given byte array to a String using the RFC 4648 "URL and Filename Safe Alphabet".

public static byte[]

Returns:

the encoded byte array
encodeUrlSafe
(byte[]
the original byte array
src
)

Base64-encode the given byte array using the RFC 4648 "URL and Filename Safe Alphabet".

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

Base64Utilsback to summary
public Base64Utils()

Method Detail

decodeback to summary
public static byte[] decode(byte[] src)

Base64-decode the given byte array.

Parameters
src:byte[]

the encoded byte array

Returns:byte[]

the original byte array

decodeFromStringback to summary
public static byte[] decodeFromString(String src)

Base64-decode the given byte array from a UTF-8 String.

Parameters
src:String

the encoded UTF-8 String

Returns:byte[]

the original byte array

decodeFromUrlSafeStringback to summary
public static byte[] decodeFromUrlSafeString(String src)

Base64-decode the given byte array from a UTF-8 String using the RFC 4648 "URL and Filename Safe Alphabet".

Parameters
src:String

the encoded UTF-8 String

Returns:byte[]

the original byte array

decodeUrlSafeback to summary
public static byte[] decodeUrlSafe(byte[] src)

Base64-decode the given byte array using the RFC 4648 "URL and Filename Safe Alphabet".

Parameters
src:byte[]

the encoded byte array

Returns:byte[]

the original byte array

Since
4.2.4
encodeback to summary
public static byte[] encode(byte[] src)

Base64-encode the given byte array.

Parameters
src:byte[]

the original byte array

Returns:byte[]

the encoded byte array

encodeToStringback to summary
public static String encodeToString(byte[] src)

Base64-encode the given byte array to a String.

Parameters
src:byte[]

the original byte array

Returns:String

the encoded byte array as a UTF-8 String

encodeToUrlSafeStringback to summary
public static String encodeToUrlSafeString(byte[] src)

Base64-encode the given byte array to a String using the RFC 4648 "URL and Filename Safe Alphabet".

Parameters
src:byte[]

the original byte array

Returns:String

the encoded byte array as a UTF-8 String

encodeUrlSafeback to summary
public static byte[] encodeUrlSafe(byte[] src)

Base64-encode the given byte array using the RFC 4648 "URL and Filename Safe Alphabet".

Parameters
src:byte[]

the original byte array

Returns:byte[]

the encoded byte array

Since
4.2.4