Base64 decoding using JDK6 only(仅使用 JDK6 进行 Base64 解码)
问题描述
这个关于JDK 5的问题说,没有提供实现JDK 5,但 JDK 6 应该有一个 sun.misc.Base64Decoder
.
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 的情况如何?
我知道那里有很多实现,比如 Commons 和 JBoss 的,但是我们有一个限制性的 3rd 方库政策,所以我试图避免重新发明轮子.
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 表明,在 Java SE 中实际上有一个(隐藏良好的)Base64 实现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).
Sun JDK 附带这个类 (sun.misc.Base64Decoder
),但没有指定它,不应使用(尤其是因为它不需要存在于其他实现甚至版本中).
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 Commons 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 解码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:仅使用 JDK6 进行 Base64 解码


基础教程推荐
- 多个组件的复杂布局 2022-01-01
- 验证是否调用了所有 getter 方法 2022-01-01
- 如何在 Spring @Value 注解中正确指定默认值? 2022-01-01
- Java Swing计时器未清除 2022-01-01
- 大摇大摆的枚举 2022-01-01
- 从 python 访问 JVM 2022-01-01
- 在 Java 中创建日期的正确方法是什么? 2022-01-01
- Java 实例变量在两个语句中声明和初始化 2022-01-01
- 如何在 JFrame 中覆盖 windowsClosing 事件 2022-01-01
- 不推荐使用 Api 注释的描述 2022-01-01