Java – working sun misc. Base64encoder / decoder get bytes []

I tried to use sun misc. Base64encoder / decoder, but this Code:

(new sun.misc BASE64Encoder()).encode(new    
    sun.misc.BASE64Decoder().decodeBuffer("test string XML:"))

I'm embarrassed to return "test / string / XML /"

Solution

Do not use sun Misc or com Sun class They do not guarantee consistency between different versions of JRE

Use commons codec Base64 encodeBase64(..) And Base64 decodeBase64(..)

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>