base 64 converter java code example
Example: Java use Base64
public static String encode(String input) {
return Base64.getEncoder().encodeToString(input.getBytes());
}
public static String decode(String input) {
byte[] decodedBytes = Base64.getDecoder().decode(input);
return new String(decodedBytes);
}
public static String encodeURL(String input) {
return Base64.getUrlEncoder().encodeToString(input.getBytes());
}
public static String decodeURL(String input) {
byte[] decodedBytes = Base64.getUrlDecoder().decode(input);
return new String(decodedBytes);
}