2021与蓝度共同重构项目,服务端
liuhaonan
2022-11-04 e55c8b0a92eb9715edd90c31dfd4de51a47b588b
ximon-admin/src/main/java/com/sandu/ximon/admin/utils/Base64Util.java
@@ -1,5 +1,6 @@
package com.sandu.ximon.admin.utils;
import com.sandu.ximon.admin.manager.iot.rrpc.util.SupplementUtils;
import org.apache.commons.codec.binary.Base64;
public class Base64Util {
@@ -30,20 +31,19 @@
        }
    }
    public static void main(String[] args) {
        byte[] bytes = "/qUBAAv+AQAD//8yjUBF9xgeI0U=".getBytes();
        byte[] bytes1 = Base64.decodeBase64(bytes);
        System.out.println(HexStrConvertUtil.bytesToHexString(bytes1));
    }
//    public static void main(String[] args) {
//        byte[] bytes = "/qUBAAv+AQAD//8yjUBF9xgeI0U=".getBytes();
//        byte[] bytes1 = Base64.decodeBase64(bytes);
//        System.out.println(SupplementUtils.bytesToHexString(bytes1));
//    }
    public static String toBase64Frame (String hexStr) {
//        BigInteger bigInteger = new BigInteger(hexStr, 16);   //  此方式会产生头部多出空的一字节
//        byte[] bytes = bigInteger.toByteArray();
//        System.out.println("origin:"+hexStr);
        byte[] bytes = HexStrConvertUtil.hexStringToBytes(hexStr);
        byte[] bytes = SupplementUtils.hexStringToBytes(hexStr);
        String base64 = encode(bytes);
        return base64;
    }
}
}