JDK8+ java.util.Base64 wrap() complementary methods

时间:2017-10-12 09:36:35

标签: java java-8 base64 stream-processing

Since JDK8, mature java.util.Base64 APIs have been added.

The only methods to stream process InputStream(s) and OutputStream(s) are, respectively:

  • Base64.get*Decoder().wrap(is)
  • Base64.get*Encoder().wrap(os).

How can I encode an InputStream or decode and OuputStream using only Java APIs in an efficient way?

Is there a reason those methods have not been added to Java APIs?

This functionality is present, for example, in net.iharder.base64, but I was migrating to Java APIs in order to remove that dependency.

0 个答案:

没有答案