简体   繁体   中英

java string base64 encoded

I need a way to know if a string is Base64 encoded... any idea ?

thanks

字符串长度必须是4的倍数,并且仅允许以下字符AZ,az,0-9 * + ,* /=作为填充字符(仅在末尾)

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/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM