将经过加密的二进制数据保存到本地的方法

byte[] src = new byte[] { 122,-69, -17, 92, -76, 52, -21, -87, -10, 105, 76, -75, 98, 38, -78, -120, -119, -55, -113, 72, 40, -118, -85, -98, 84, -87 };
    //定义一个BASE64Encoder 
    BASE64Encoder encode = new BASE64Encoder(); 
    //将byte[]转换为base64
    String base64 = encode.encode(src);
    System.err.println(base64);
    //新建一个BASE64Decoder 
    BASE64Decoder decode = new BASE64Decoder(); 
    //将base64转换为byte[]
    byte[] b = decode.decodeBuffer(base64);
    System.err.println(Arrays.toString(b));
    System.err.println(Arrays.toString(src));
    String srcString=Arrays.toString(src);
    System.err.println(srcString);

 

相关文章:

  • 2021-11-17
  • 2022-12-23
  • 2021-05-28
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-11
猜你喜欢
  • 2021-12-01
  • 2022-12-23
  • 2022-01-30
  • 2022-12-23
  • 2022-12-23
  • 2021-10-22
  • 2022-12-23
相关资源
相似解决方案