base64tomcat7java-5weblogic9.x

Is there non-weblogic alternative to weblogic.utils.encoders.BASE64Decoder and BASE64Encoder?


Trying to port some applications from WebLogic to Tomcat (or maybe JBoss). Some of this code has the following import statements:

import weblogic.utils.encoders.BASE64Decoder;
import weblogic.utils.encoders.BASE64Encoder;

which are then instantiated by

private static BASE64Encoder base64Encoder = new BASE64Encoder();
private static BASE64Decoder base64Decoder = new BASE64Decoder();

Is there an alternative implementation that is available without depending on weblogic code? Ideally one that would change nothing but the import statements?

Thanks.

Update: also needs to be compilable under JDK1.5


Solution

  • Yes, there's java.util.Base64.

    There are various factory methods to obtain encoders configured in slightly different ways for encoding characters and line breaks.