|
@@ -3,9 +3,7 @@ package de.tudarmstadt.informatik.hostage.commons;
|
|
|
import java.net.InetAddress;
|
|
|
import java.net.UnknownHostException;
|
|
|
import java.security.KeyStore;
|
|
|
-import java.util.concurrent.ExecutionException;
|
|
|
|
|
|
-import org.apache.http.HttpResponse;
|
|
|
import org.apache.http.HttpVersion;
|
|
|
import org.apache.http.client.HttpClient;
|
|
|
import org.apache.http.client.methods.HttpPost;
|
|
@@ -24,10 +22,7 @@ import org.apache.http.protocol.HTTP;
|
|
|
|
|
|
import de.tudarmstadt.informatik.hostage.logging.Record;
|
|
|
import de.tudarmstadt.informatik.hostage.net.MySSLSocketFactory;
|
|
|
-import de.tudarmstadt.informatik.hostage.ui.MainActivity;
|
|
|
import android.content.Context;
|
|
|
-import android.content.SharedPreferences;
|
|
|
-import android.content.SharedPreferences.Editor;
|
|
|
import android.net.ConnectivityManager;
|
|
|
import android.net.NetworkInfo;
|
|
|
import android.net.wifi.WifiInfo;
|
|
@@ -185,7 +180,7 @@ public final class HelperUtils {
|
|
|
StringEntity se = new StringEntity(record.toString(0x01));
|
|
|
httppost.setEntity(se);
|
|
|
// Execute HttpPost
|
|
|
- HttpResponse response = httpclient.execute(httppost);
|
|
|
+ httpclient.execute(httppost);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
return false;
|
|
@@ -241,8 +236,12 @@ public final class HelperUtils {
|
|
|
return (character > 31 && character < 127);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- public static String byteToHexString(byte[] bytes) {
|
|
|
+ /**
|
|
|
+ * Converts a byte array into a hexadecimal String, e.g. {0x00, 0x01} to "0x00, 0x01".
|
|
|
+ * @param bytes that will be converted.
|
|
|
+ * @return converted String.
|
|
|
+ */
|
|
|
+ public static String bytesToHexString(byte[] bytes) {
|
|
|
char[] hexArray = "0123456789ABCDEF".toCharArray();
|
|
|
int v;
|
|
|
StringBuffer buffer = new StringBuffer();
|
|
@@ -255,9 +254,12 @@ public final class HelperUtils {
|
|
|
return buffer.toString();
|
|
|
}
|
|
|
|
|
|
- public static byte[] hexStringToByte(String string) {
|
|
|
- char[] hexArray = "0123456789ABCDEF".toCharArray();
|
|
|
- int v;
|
|
|
+ /**
|
|
|
+ * Converts a String into a byte array, e.g. "0x00, 0x01" to {0x00, 0x01}.
|
|
|
+ * @param string that will be converted.
|
|
|
+ * @return converted byte array.
|
|
|
+ */
|
|
|
+ public static byte[] hexStringToBytes(String string) {
|
|
|
String[] hexStrings = string.split(", ");
|
|
|
byte[] bytes = new byte[hexStrings.length];
|
|
|
for(int j = 0; j < hexStrings.length; j++ ) {
|