Java equivalent of Convert.FromBase64String Method

安稳与你 提交于 2019-12-07 23:20:26

问题


Is there some Java equivalent of Convert.FromBase64String which

Converts the specified string, which encodes binary data as base-64 digits, to an equivalent 8-bit unsigned integer array.

I have tried:

  • com.lutris.util.Convert. but it gives me signed values
  • encode to string then convert to unsigned bytes, but then it gives me completely wrong output (wrong length and data).

Will be grateful for any suggestions!


回答1:


In general, chances are good that if the standard Java libraries don't have something you need, the Apache Commons framework does. In this case, you want the decodeBase64 method from commons.codec.binary.Base64.



来源:https://stackoverflow.com/questions/2274925/java-equivalent-of-convert-frombase64string-method

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!