[FEATURE] Finished local server loading

This commit is contained in:
JKetelaar
2016-01-09 21:30:26 +01:00
parent ce92e7389f
commit 6d3ab146ac
4 changed files with 210 additions and 4 deletions
@@ -2,7 +2,9 @@ package org.parabot.environment.api.utils;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.channels.FileChannel;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
@@ -65,4 +67,25 @@ public class FileUtil {
return null;
}
public static void copyFile(File sourceFile, File destFile)
throws IOException {
if (!sourceFile.exists()) {
return;
}
if (!destFile.exists()) {
destFile.createNewFile();
}
FileChannel source = null;
FileChannel destination = null;
source = new FileInputStream(sourceFile).getChannel();
destination = new FileOutputStream(destFile).getChannel();
if (source != null) {
destination.transferFrom(source, 0, source.size());
}
if (source != null) {
source.close();
}
destination.close();
}
}