encoding und decoding methods mit Base64 implementiert

get_all_user
Daniel Zdravkovic 2024-06-10 13:34:52 +02:00
parent a41384a116
commit 5120dd94be
1 changed files with 11 additions and 1 deletions

View File

@ -11,6 +11,7 @@ import java.util.Arrays;
import java.util.HashSet;
import java.util.TreeSet;
import org.apache.commons.codec.binary.Base64;
import org.json.JSONObject;
public class System {
@ -39,8 +40,17 @@ public class System {
this.current_user.setBike_avg_kmh(bike_avg_kmh);
}
public void encoding(String string){
public void decoding(String string){
byte[] binary_data = Base64.decodeBase64(string);
string = new String(binary_data);
}
public void encoding(String string){
byte[] binary_data = new byte[string.length()];
for(int i = 0; i < string.length(); i++){
binary_data[i] = (byte) string.charAt(i);
}
string = Base64.encodeBase64String(binary_data);
}
public HashSet<User> get_all_user() throws FileNotFoundException, IOException{