只使用JDK6 Base64编码解码 [英] Base64 decoding using JDK6 only

查看:883
本文介绍了只使用JDK6 Base64编码解码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这对于JDK 5 说的问题,有没有提供JDK 5,但JDK 6实现应该有一个 sun.misc.Base64De codeR

This question with regard to JDK 5 says, there is no implementation provided with JDK 5, but JDK 6 is supposed to have a sun.misc.Base64Decoder.

据我可以告诉虽然,这个类是不具备的JDK,我无法找到任何其他相似的类在其搜索结果那么,是什么样的与JDK6的情况呢?
结果我知道大量的实现有像下议院和JBoss的人,但我们有一个严格的第三方的lib政策,所以我尽量避免重蹈覆辙。

As far as I can tell though, this class is not provided with the JDK and I was not able to find any other similar classes in it

So, what is the situation like with JDK6?

I am aware of numerous implementations out there like the Commons and the JBoss ones, but we have a restrictive 3rd party lib policy, so I am trying to avoid reinventing the wheel.

推荐答案

没有,情况并没有的Java 5和Java 6之间切换

No, the situation didn't change between Java 5 and Java 6.

<击>不幸的是,在Java SE平台没有官方的Base64实现。 @bestsss表明,有其实是一种(精心隐藏)的Base64在Java SE实现6(看他的更多细节的答案)。

Unfortunately there is no official Base64 implementation in the Java SE platform. @bestsss has shown that there is in fact a (well-hidden) Base64 implementation in Java SE 6 (see his answer for more detail).

太阳JDK附带了这个类( sun.misc.Base64De codeR ),但它未指定的不应该使用(尤其是在其他实现,甚至版本存在它不需要)。

The Sun JDK ships with this class (sun.misc.Base64Decoder), but it's not specified and should not be used (especially as it's not required to exist in other implementations or even versions).

如果你绝对需要避免第三方库( Apache的共享codeC 是的 Base64的实施),那么你可能要一个BSD许可(或类似)版本复制到您的项目。有一个公共领域实施,这就是关于无痛,因为它得到,当它涉及牌照。

If you absolutely need to avoid third party libraries (Apache Commons Codec would be the traditional provider of a Base64 implementation), then you might want to copy a BSD (or similarly) licensed version into your project. There is a public domain implementation and that's about as painless as it gets, when it comes to licenses.

这篇关于只使用JDK6 Base64编码解码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆