Java8 的 Base64.Encoder 有一个私有构造函数

Java8's Base64.Encoder has a private constructor

该构造函数启用 url-安全的无填充编码。对预定义编码器的访问是通过 Base64 上的静态方法。不幸的是,urlSafeEncoder() 允许填充。没有必要使用 url-安全且没有填充的编码器。

除了删除尾随的等号之外,有人知道解决这个问题的方法吗?

使用 withoutPadding() 怎么样?

Returns an encoder instance that encodes equivalently to this one, but without adding any padding character at the end of the encoded byte data.