Base64 Encoder/Decoder Java Library
This Java™ library implements Base64 encoding and decoding. It was written because I couldn't find anything like it in the JDK except for an internal class in com.sun.*
The differences between this library and most others are:
- It supports encoding and decoding of input streams in chunk mode.
- The size of the internal allocated input buffer can be restricted.
When encoding or decoding an string or byte array only the result buffer gets allocated, the source is used as input buffer.
This implementation is based on http://en.wikipedia.org/wiki/Base64 and RFC 2045 (section 6.8). However, support for the line break mode in 76 character blocks mentioned in the RFC are not supported, mostly because I don't have any use of it.
The library has been verified to produce the same result as other commonly used implementations, among them:
- The base64_encode() and base64_decode() functions in PHP.
- The base64 command from GNU coreutils.