/*
 * Decompiled with CFR 0.152.
 * 
 * Could not load the following classes:
 *  sun.misc.BASE64Decoder
 *  sun.misc.BASE64Encoder
 */
package com.hst.common.util;

import com.hst.framework.util.HstToolsUtil;
import java.io.IOException;
import sun.misc.BASE64Decoder;
import sun.misc.BASE64Encoder;

public class Base64 {
    public static String byteToString(byte[] data) {
        BASE64Encoder encoder = new BASE64Encoder();
        return encoder.encode(data);
    }

    public static byte[] stringToByte(String str) throws Exception {
        byte[] b = null;
        if (HstToolsUtil.isNullOrEmpty(str)) {
            return new byte[0];
        }
        BASE64Decoder decoder = new BASE64Decoder();
        try {
            b = decoder.decodeBuffer(str);
        }
        catch (IOException e) {
            e.printStackTrace();
            throw new Exception("Base64\u89e3\u7801 Exception");
        }
        return b;
    }
}
