Browse Source

Small changes

lp-tu 10 years ago
parent
commit
23d50ac8aa

+ 6 - 9
src/de/tudarmstadt/informatik/hostage/io/ByteArrayReaderWriter.java

@@ -22,15 +22,12 @@ public class ByteArrayReaderWriter implements ReaderWriter<ByteArray> {
 
 	@Override
 	public ByteArray read() throws IOException {
-		while (in.available() == 0) {
-			Thread.yield();
-		}
-		ByteArrayOutputStream os = new ByteArrayOutputStream();
-		int oneByte;
-		while ((oneByte = in.read()) != -1) {
-			os.write(oneByte);
-		}
-		return new ByteArray(os.toByteArray());
+		int availableBytes;
+		while ((availableBytes = in.available()) <= 0)
+		;
+		byte[] buffer = new byte[availableBytes];
+		in.read(buffer);
+		return new ByteArray(buffer);
 	}
 
 	@Override

+ 0 - 2
src/de/tudarmstadt/informatik/hostage/logging/DatabaseHandler.java

@@ -9,7 +9,6 @@ import android.content.Context;
 import android.database.Cursor;
 import android.database.sqlite.SQLiteDatabase;
 import android.database.sqlite.SQLiteOpenHelper;
-import android.util.Log;
 /**
  * This class creates SQL tables and handles all access to the database.<br>
  * It contains several methods with predefined queries to extract different kinds of information from the database.<br>
@@ -134,7 +133,6 @@ public class DatabaseHandler extends SQLiteOpenHelper {
 		record.setPacket(cursor.getString(12));
 		record.setSSID(cursor.getString(13));
 		} catch (UnknownHostException e) {
-			// TODO Auto-generated catch block
 			e.printStackTrace();
 		}
 		return record;

+ 1 - 1
src/de/tudarmstadt/informatik/hostage/logging/Record.java

@@ -211,7 +211,7 @@ public class Record implements Serializable {
 	}
 	
 	/**
-	 * Returns a string representation after a chosen format. Formats should be defined in /res/values/export_formats.xml to use with {@link de.tudarmstadt.informatik.hostage.ui.ViewLog#exportDatabase(android.view.View)}
+	 * Returns a string representation after a chosen format. Formats should be defined in /res/values/arrays.xml to use with {@link de.tudarmstadt.informatik.hostage.ui.ViewLog#exportDatabase(android.view.View)}
 	 * The Intger representation of the format is equal to its position in the format array.
 	 * @param format Integer representation of the format.
 	 * @return A string representation after chosen format.

+ 3 - 1
src/de/tudarmstadt/informatik/hostage/ui/ViewLog.java

@@ -252,7 +252,9 @@ public class ViewLog extends Activity {
 
 	/**
 	 * Creates a Dialog that lets the user decide which criteria he want to use to delete records.
-	 * Then calls the corresponding method.
+	 * Then calls the corresponding method.<br>
+	 * The possible criteria are coded in /res/values/arrays.xml
+	 * To add a criteria add a String to the array and extend the switch statement.
 	 * @param view View elements which triggers the method call.
 	 * @see ViewLog#deleteByBSSID()
 	 * @see ViewLog#deleteByDate()