title: Should I use new BASE64Encoder() or Base64.getEncoder() to encode images in java?
body: <p>In Java we find both classes <code>Base64</code> and <code>BASE64Encoder</code> to perform base64 encoding on bytes via </p>
  
  <p><code>Base64.getEncoder.encodeToString(someByteArray);</code></p>
  
  <p>and respectively:</p>
  
  <p><code>new BASE64Encoder().encode(someByteArray);</code></p>
  
  <p>I am trying to base64 encode an image file, which will return a relatively large String (6k-7k character long base64)</p>
  
  <p>Is there any convention to using one above the other, any performance differences or other reasons to use one above the other?</p>