Base64 encode and decode example code

后端 未结 12 937
遥遥无期
遥遥无期 2020-11-22 15:00

Does anyone know how to decode and encode a string in Base64 using the Base64. I am using the following code, but it\'s not working.

String source = \"passwo         


        
12条回答
  •  感情败类
    2020-11-22 15:41

    For API level 26+

    String encodedString = Base64.getEncoder().encodeToString(byteArray);
    

    Ref: https://developer.android.com/reference/java/util/Base64.Encoder.html#encodeToString(byte[])

提交回复
热议问题