package com intel GPA import java io File import java io IOException p

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
package com.intel.GPA;
import java.io.File;
import java.io.IOException;
public class Extraction {
public Extraction(File gpa_frame, Settings sett) {
this.target = gpa_frame;
EXTRACT_TOOL = sett.getBinDir() + "\\" + sett.getPlaybackTool();
OUT_FILE = sett.getWorkDir() + "\\" + target.getName();
}
public boolean extract() {
String[] query = { EXTRACT_TOOL, "-m", OUT_FILE, target.getName() };
try {
Process p = Runtime.getRuntime().exec(query);
thread = new Thread(new Daemon(Thread.currentThread()), "Daemon");
thread.setDaemon(true);
thread.start();
if (p.waitFor() == 0) {
return true;
} else {
return false;
}
} catch (InterruptedException e) {
p.destroy();
log = e.getMessage();
return false;
} catch (IOException e) {
log = e.getMessage();
return false;
}
}
public String getLog() {
return this.log;
}
private class Daemon implements Runnable {
public Daemon(Thread arg) {
t = arg;
}
public void run() {
try {
Thread.sleep(60000);
t.interrupt();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
private Thread t;
}
private Thread thread;
private Process p;
private File target = null;
private String EXTRACT_TOOL = "";
private String OUT_FILE = "";
private String log = "";
}