Rar-Archive entpacken
Friday, August 07th, 2009public boolean unrarFiles(String path, String file) {
Process p;
String s = null;
File file = new File(path+str);
if (file.exists())
{
System.out.println(“[System] Found file “+str);
System.out.println(“[System] Start unpacking”);
try {
p = Runtime.getRuntime().exec(path+”UnRAR.exe e “+path+ str +” “+path);
BufferedReader output = new BufferedReader(new InputStreamReader(p.getInputStream()));
System.out.println(“Entpacke:\n”);
while ((s = output.readLine()) != null) {
System.out.println(s);
}
p.waitFor();
return true;
}
catch (IOException ex) {
// Do something
return false;
}
catch (InterruptedException ex) {
// Do something
return false;
}
}
else {
System.out.println(“[System] Couldn’t find file “+str);
return false;
}
}