public synchronized void writeProgress(int current_file, int total_files) {
    try {

      DataOutputStream out =
          new DataOutputStream(new BufferedOutputStream(new FileOutputStream(resume_file, false)));
      out.writeInt(current_file);
      out.writeInt(total_files);
      out.flush();
      out.close();

    } catch (FileNotFoundException e) {
      e.printStackTrace();
      Log.e(TAG, "writeProgress resume.txt not found.");
    } catch (IOException ex) {
      Log.e(TAG, "Unable to create resume.txt.");
    }
  }
Ejemplo n.º 2
0
  void storeConfig() {
    DataOutputStream out;

    try {
      out = new DataOutputStream(openFileOutput("wscnprefs", Context.MODE_PRIVATE));
      out.writeByte(1); // version
      out.writeInt(ScanService.scanData.getFlags()); // operation flags;
      out.writeInt(ScanService.scanData.getStoredValues()); // number of currently stored values
      out.writeInt(ScanService.scanData.getUploadedCount());
      out.writeInt(ScanService.scanData.getUploadedRank());
      out.writeInt(0); // Open WLANs, no longer used
      out.writeInt(ScanService.scanData.getFreeHotspotWLANs());
      out.writeFloat(ScanService.scanData.getTelemetryData().getCorrAccelX());
      out.writeFloat(ScanService.scanData.getTelemetryData().getCorrAccelY());
      out.writeFloat(ScanService.scanData.getTelemetryData().getCorrAccelZ());
      out.writeFloat(ScanService.scanData.getTelemetryData().getCorrCoG());
      out.writeFloat(ScanService.scanData.getTelemetryData().getCorrOrientY());
      out.writeFloat(ScanService.scanData.getTelemetryData().getCorrOrientZ());
      out.close();
    } catch (IOException ioe) {
      ioe.printStackTrace();
    }
  }