java string base64 encoded
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/
精彩评论