Good news for Base64

Plans to include Base64 API in OpenJDK

Progress behind Oracle's Java 8 open source implementation, Open JDK is motoring on into 2012, with numerous JDK Enhancement Proposals cropping up. But one recent suggestion will finally tackle the long overdue issue of a standard API for Base64 encoding and decoding.

Oracle's Alan Bateman made the submission back in November but it appears that it will become part of the next full stable release of the JDK. Bateman stated the motivation behind proposing a standardised and fully supported Base64 API:

Base64 encoding schemes are frequently used to encode binary/octet sequences that are transmitted as textual data. It is commonly used by applications using Multipurpose Internal Mail Extensions (MIME), encoding passwords for HTTP headers, message digests, etc.

The JDK is long overdue a standard API for Base64 encoding and decoding. It has been frequently requested by developers for many years, many resorting to using JDK private and unsupported classes such as sun.misc.BASE64Encoder andsun.misc.BASE64Decoder.

The JDK itself has several internal implementations: java.util.prefs.Base64,com.sun.org.apache.xml.internal.security.utils.Base64, andcom.sun.net.httpserver.Base64 to name a few. A standard API would allow these sorts of implementations to be retired.

The plan of action - to define a simple API, likely in java.util for encoding and decoding then assess which of the unsupported versions are no longer needed with the API in place. Of course, this would incur a heavy amount of testing to get it ready for JDK 8.

Keeping track of all the proposals that could be set to feature in OpenJDK: JDK 8 is a wise move - there are some intriguing propositions. The two key projects - Lambda and Jigsaw are also worth monitoring - we may well see some movement there incredibly soon.

Chris Mayer

What do you think?

Comments

Latest opinions