Merge pull request #6 from scottstamp/patch-1

Removed use of deprecated Java EE component
This commit is contained in:
sirjonasxx 2018-10-12 00:49:48 +02:00 committed by GitHub
commit 3433657eb4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,7 +3,6 @@ package main.protocol.memory.habboclient.windows;
import main.protocol.HConnection; import main.protocol.HConnection;
import main.protocol.memory.habboclient.HabboClient; import main.protocol.memory.habboclient.HabboClient;
import javax.xml.bind.DatatypeConverter;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
@ -44,11 +43,21 @@ public class WindowsHabboClient extends HabboClient {
ArrayList<String> possibleData = readPossibleBytes(); ArrayList<String> possibleData = readPossibleBytes();
for (String possibleHexStr : possibleData) { for (String possibleHexStr : possibleData) {
result.add(DatatypeConverter.parseHexBinary(possibleHexStr)); result.add(hexStringToByteArray(possibleHexStr));
} }
} catch (IOException | URISyntaxException e) { } catch (IOException | URISyntaxException e) {
e.printStackTrace(); e.printStackTrace();
} }
return result; return result;
} }
public static byte[] hexStringToByteArray(String s) {
int len = s.length();
byte[] data = new byte[len / 2];
for (int i = 0; i < len; i += 2) {
data[i / 2] = (byte) ((Character.digit(s.charAt(i), 16) << 4)
+ Character.digit(s.charAt(i+1), 16));
}
return data;
}
} }