Android Open Source - android-forensics Utils






From Project

Back to project page android-forensics.

License

The source code is released under:

MIT License

If you think the Android project android-forensics listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package pt.ist.androidforensics.utils;
/*from w  ww  .ja v  a 2 s.c  om*/
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;

import android.util.Log;

import pt.ist.androidforensics.data.Model;

public class Utils {

  /**
   * Writes to file the list of objects in csv format
   * @param models list to save
   * @param path filepath eg: "sdcard/log.file"
   */
  public static void writeCSV(ArrayList<Model> models, String path) {
    File logFile = new File(path);
    if (!logFile.exists()) {
      try {
        logFile.createNewFile();
      } catch (IOException e) {
        e.printStackTrace();
      }
    }
    try {
      BufferedWriter buf = new BufferedWriter(new FileWriter(logFile,  true));
      buf.append(models.get(0).toCSVHeader());
      Log.d("saved file header", models.get(0).toCSVHeader() );

      buf.newLine();
      for (Model m : models) {
        Log.d("saved file",m.toString() );
        Log.d("saved file CSV --->",m.toCSV());

        buf.append(m.toCSV());
        buf.newLine();
      }
      buf.close();
    } catch (IOException e) {
      e.printStackTrace();
    }
  }

}




Java Source Code List

pt.ist.androidforensics.AndroidForensicsApp.java
pt.ist.androidforensics.ExportCallLog.java
pt.ist.androidforensics.ExportContacts.java
pt.ist.androidforensics.ExportMessages.java
pt.ist.androidforensics.MainActivity.java
pt.ist.androidforensics.data.Call.java
pt.ist.androidforensics.data.Contact.java
pt.ist.androidforensics.data.Model.java
pt.ist.androidforensics.data.Sms.java
pt.ist.androidforensics.utils.Utils.java