RFR: 8026330: java.util.Base64 urlEncoder should omit padding
Alan.Bateman at oracle.com
Fri Nov 8 14:00:47 UTC 2013
On 06/11/2013 18:44, Xueming Shen wrote:
> The latest spec and implementation of java.util.Base64.getXXXEncoder()
> is to add appropriate padding character(s) at the end of the output
> encoded data stream, to follow the note explicitly specified in the
> Implementations MUST include appropriate pad characters at the end
> of encoded data unless the specification referring to this document
> explicitly states otherwise.
> However the RFE also mentions that
> In some circumstances, the use of padding ("=") in base-encoded data
> is not required or used...
> Feedback so far also suggests that Base64.encoder without padding might
> be desired in some real world use scenario.
> So here is the webrev to add a new method to the Encoder class to return
> a non-padding version.
The API looks okay although some developers might not initially
recognize that an Encoder is immutable. In particularly, this statement
might not be clear:
"This instance of encoder is unaffected by this invocation."
What you would think about including an example in the javadoc so that
it's clear how to get an Encoder that doesn't emit padding?
Otherwise this looks good except that I wonder about needing to eagerly
create all 6 Encoders.
So are you trying to get this into 8 or are you thinking of holding this
More information about the core-libs-dev