code: @Nonnull
    public static String encodeFromFile (@Nonnull final String filename) throws IOException
    {
      // Setup some useful variables
      final File file = new File (filename);
  
      // Open a stream
      try (final Base64InputStream bis = new Base64InputStream (FileHelper.getBufferedInputStream (file), ENCODE))
      {
        // Need max() for math on small files (v2.2.1);
        // Need +1 for a few corner cases (v2.3.5)
        final byte [] aBuffer = new byte [Math.max ((int) (file.length () * 1.4 + 1), 40)];
  
        int nLength = 0;
        int nBytes;
  
        // Read until done
        while ((nBytes = bis.read (aBuffer, nLength, 4096)) >= 0)
        {
          nLength += nBytes;
        }
  
        // Save in a variable to return
        return new String (aBuffer, 0, nLength, PREFERRED_ENCODING);
      }
    }
docs: Convenience method for reading a binary file and base64-encoding it.
  <p>
  As of v 2.3, if there is a error, the method will throw an IOException.
  <b>This is new to v2.3!</b> In earlier versions, it just returned false,
  but in retrospect that's a pretty poor way to handle it.
  </p>
  
  @param filename
  Filename for reading binary data
  @return base64-encoded string
  @throws IOException
  if there is an error
  @since 2.1