public static byte[] encode(byte[] in) {
        byte[] encoded = Base64.getEncoder().encode(in);
        for (int i = 0; i < encoded.length; i++) {
            if (encoded[i] == '+') encoded[i] = '.';
            else if (encoded[i] == '/') encoded[i] = '_';
            else if (encoded[i] == '=') encoded[i] = '-';
        }
        return encoded;
    }
Variant of {@link java.util.Base64} with the following modifications:
- {@code +} is replaced by {@code .}
- {@code /} is replaced by {code _}
- {@code =} is replaced by {code -}

@author bjorncs
security-utils/src/main/java/com/yahoo/security/YBase64.java