更新时间:2023-01-18 19:34:22
问题是你正在返回调用 Base64.encodeBase64(bytes)
的 toString()
code> 返回一个字节数组.所以你最后得到的是一个字节数组的默认字符串表示,它对应你得到的输出.
The problem is that you are returning the toString()
of the call to Base64.encodeBase64(bytes)
which returns a byte array. So what you get in the end is the default string representation of a byte array, which corresponds to the output you get.
相反,您应该这样做:
encodedfile = new String(Base64.encodeBase64(bytes), "UTF-8");