小编scs*_*075的帖子

byte []再次转换为字符串[]

这是我想要做的.我有一个byte [],我需要用密钥存储在Redis中(比如key1)Redis会将它存储为String.我需要在通过key1检索值时重建byte []

    //here is a byte array
    byte[] bArr = new byte[] {83, 71, 86, 115, 98, 71, 56, 103, 84, 88, 73, 117, 73, 69, 104, 118, 100, 121, 66, 107, 98, 121, 66, 53, 98, 51, 85, 103, 90, 71, 56, 47}; //"Hello World"; 

    // I will have to store this as a byte string into redis
    //Base64 encoding
    bArr = Base64.encodeBase64(bArr);
    String storeStr = Arrays.toString(bArr) ;
    // storeStr is what gets stored in redis
    System.out.println("storeStr>>" + …
Run Code Online (Sandbox Code Playgroud)

java bytearray

1
推荐指数
1
解决办法
3732
查看次数

标签 统计

bytearray ×1

java ×1