mirror of
https://github.com/2006-Scape/Parabot.git
synced 2026-07-03 16:49:10 +00:00
[FEATURE] Finished local server loading
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user