Decode Base64 data in Java

前端 未结 20 1874
时光说笑
时光说笑 2020-11-21 06:04

I have an image that is Base64 encoded. What is the best way to decode that in Java? Hopefully using only the libraries included with Sun Java 6.

20条回答
  •  深忆病人
    2020-11-21 06:44

    The Java 8 implementation of java.util.Base64 has no dependencies on other Java 8 specific classes.

    I am not certain if this will work for Java 6 project, but it is possible to copy and paste the Base64.java file into a Java 7 project and compile it with no modification other than importing java.util.Arrays and java.util.Objects.

    Note the Base64.java file is covered by the GNU GPL2

提交回复
热议问题