Java use Base64
//For Strings:
//Encode:
public static String encode(String input) {
return Base64.getEncoder().encodeToString(input.getBytes());
}
//Decode:
public static String decode(String input) {
byte[] decodedBytes = Base64.getDecoder().decode(input);
return new String(decodedBytes);
}
//For Urls
//Encode:
public static String encodeURL(String input) {
return Base64.getUrlEncoder().encodeToString(input.getBytes());
}
//Decode:
public static String decodeURL(String input) {
byte[] decodedBytes = Base64.getUrlDecoder().decode(input);
return new String(decodedBytes);
}
Also in Java:
- parsedouble java
- java script find screen size of device
- from file to array java
- prendere valore da tastiera java
- leap year program in java
- check if optional is empty java
- convert hashset to int array java
- java read file from command line argument
- how to break two loop in java
- how add strings together
- how to check if a string is in alphabetical order in java
- cannot lock java compile cache as it has already been locked by this process
- bukkit java get player count
- java set value of arraylist
- how to create a linked list in java
- java unique id
- make a commet in java
- java how to program
- how to open a folder in java swing project
- how to do 4th root java
- java get an int from a char
- how lock horizontal orientation android
- how to declare an array in java
- java insert element at position