Commit 46531748 authored by Markus Bauer's avatar Markus Bauer
Browse files

Code style

parent 66d39f31
......@@ -147,37 +147,36 @@ public class Pseuco {
private final static String savedMainPackageName = CodeGen.mainPackageName;
private final static String savedMonitorPackageName = CodeGen.monitorPackageName;
private final static String savedStructPackageName = CodeGen.structPackageName;
public static void unZipIt(String zipFile, String outputFolder){
byte[] buffer = new byte[1024];
try{
File folder = new File(outputFolder);
if(!folder.exists()){
folder.mkdir();
}
else {
del(new File(outputFolder));
}
ZipInputStream zis = new ZipInputStream(ResourceLoader.loadResource(zipFile)); //new ZipInputStream(new FileInputStream(zipFile));
ZipEntry ze = zis.getNextEntry();
while(ze!=null){
String fileName = ze.getName();
File newFile = new File(outputFolder + File.separator + fileName);
new File(newFile.getParent()).mkdirs();
FileOutputStream fos = new FileOutputStream(newFile);
int len;
while ((len = zis.read(buffer)) > 0) {
fos.write(buffer, 0, len);
}
fos.close();
ze = zis.getNextEntry();
}
zis.closeEntry();
zis.close();
} catch(IOException ex){
handleException(ex);
}
public static void unZipIt(String zipFile, String outputFolder) {
byte[] buffer = new byte[1024];
try {
File folder = new File(outputFolder);
if (!folder.exists()) {
folder.mkdir();
} else {
del(folder);
}
ZipInputStream zis = new ZipInputStream(ResourceLoader.loadResource(zipFile)); //new ZipInputStream(new FileInputStream(zipFile));
ZipEntry ze = zis.getNextEntry();
while (ze != null) {
String fileName = ze.getName();
File newFile = new File(outputFolder + File.separator + fileName);
new File(newFile.getParent()).mkdirs();
FileOutputStream fos = new FileOutputStream(newFile);
int len;
while ((len = zis.read(buffer)) > 0) {
fos.write(buffer, 0, len);
}
fos.close();
ze = zis.getNextEntry();
}
zis.closeEntry();
zis.close();
} catch (IOException ex) {
handleException(ex);
}
}
public static void handleException(Throwable t){
......@@ -198,16 +197,8 @@ public class Pseuco {
File aktFile = new File(dir.getPath(), entries[x]);
del(aktFile);
}
if (dir.delete())
return true;
else
return false;
} else {
if (dir.delete())
return true;
else
return false;
}
return dir.delete();
}
public static Runnable getOnProgramFinished() {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment