开发者

java string base64 encoded

开发者 https://www.devze.com 2023-01-20 17:44 出处:网络
I need a way to know if a string is Base64 encoded... any idea 开发者_Python百科? thanksThe string length hast to be a multiple of 4 and only the following characters are allowed

I need a way to know if a string is Base64 encoded... any idea 开发者_Python百科?

thanks


The string length hast to be a multiple of 4 and only the following characters are allowed A-Z, a-z, 0-9 *+, */ and = as padding character (only at the end)


IMHO you need to try to decode it, and if it fails - it is not encoded.

There are many Base64 decoders for Java, here are some:

sun.misc.BASE64Decoder

Apache codec

http://migbase64.sourceforge.net/

http://www.source-code.biz/base64coder/java/

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号