更新时间:2023-01-18 18:47:31
问题是你要返回的 toString()
调用 Base64.encodeBase64(bytes)
,返回一个字节数组。所以你最后得到的是字节数组的默认字符串表示,它对应于你得到的输出。
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");