From 0a1482451fcd7ccbf42cccc8d8709d6eac02b3fe Mon Sep 17 00:00:00 2001 From: Daniel Zdravkovic <3012893@stud.hs-mannheim.de> Date: Mon, 10 Jun 2024 15:19:24 +0200 Subject: [PATCH] encoding / decoding method fix --- src/main/java/de/hs_mannheim/domain/System.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/de/hs_mannheim/domain/System.java b/src/main/java/de/hs_mannheim/domain/System.java index 2a738c5..055ccf3 100644 --- a/src/main/java/de/hs_mannheim/domain/System.java +++ b/src/main/java/de/hs_mannheim/domain/System.java @@ -40,17 +40,17 @@ public class System { this.current_user.setBike_avg_kmh(bike_avg_kmh); } - public void decoding(String string){ + public String decoding(String string){ byte[] binary_data = Base64.decodeBase64(string); - string = new String(binary_data); + return new String(binary_data); } - public void encoding(String string){ + public String 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); + return Base64.encodeBase64String(binary_data); } public HashSet get_all_user() throws FileNotFoundException, IOException{ @@ -65,7 +65,7 @@ public class System { while((path = bufferedReader.readLine()) != null){ fileString = path.split(";"); - encoding(fileString[1]); + fileString[1] = encoding(fileString[1]); all_users.add(new User(fileString[0], fileString[1], fileString[2], Integer.parseInt(fileString[3]), fileString[4], Double.parseDouble(fileString[5]),