All Downloads are FREE. Search and download functionalities are using the official Maven repository.

spring.turbo.util.crypto.Base64 Maven / Gradle / Ivy

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 *    ____             _            _____           _
 *   / ___| _ __  _ __(_)_ __   __ |_   _|   _ _ __| |__   ___
 *   \___ \| '_ \| '__| | '_ \ / _` || || | | | '__| '_ \ / _ \
 *    ___) | |_) | |  | | | | | (_| || || |_| | |  | |_) | (_) |
 *   |____/| .__/|_|  |_|_| |_|\__, ||_| \__,_|_|  |_.__/ \___/
 *         |_|                 |___/   https://github.com/yingzhuo/spring-turbo
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
package spring.turbo.util.crypto;

/**
 * @author 应卓
 * @since 1.0.0
 */
public final class Base64 {

    /**
     * 私有构造方法
     */
    private Base64() {
        super();
    }

    public static byte[] decode(String key) {
        return java.util.Base64.getUrlDecoder().decode(key);
    }

    public static String encode(byte[] key) {
        return new String(java.util.Base64.getUrlEncoder().encode(key));
    }

    public static byte[] toBytes(String key) {
        return decode(key);
    }

    public static String toString(byte[] bytes) {
        return encode(bytes);
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy