Java Base64 base64UrlFriendly(String base)

Here you can find the source of base64UrlFriendly(String base)

Description

base Url Friendly

License

Open Source License

Declaration

public static String base64UrlFriendly(String base) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.Base64;

public class Main {
    public static String base64UrlFriendly(String base) {
        return base.replace("+", "-").replace("/", "_").replace("=", "");
    }/*from   ww  w. j a v  a 2s  .  co  m*/

    public static String base64UrlFriendly(byte[] buff) {
        return base64UrlFriendly(base64(buff));
    }

    public static String base64(byte[] buff) {
        return new String(Base64.getEncoder().encode(buff));
        //return DatatypeConverter.printBase64Binary(buff);
    }
}

Related

  1. base64ToBits(char data)
  2. base64ToByteArray(String s)
  3. base64ToBytes(final String base64)
  4. base64ToBytes(String value)
  5. base64toInt(char c, byte[] alphaToInt)
  6. base64Value(char digit)