2016-10-17 06:30:35 +02:00
|
|
|
/*
|
|
|
|
* To change this license header, choose License Headers in Project Properties.
|
|
|
|
* To change this template file, choose Tools | Templates
|
|
|
|
* and open the template in the editor.
|
|
|
|
*/
|
2016-10-26 15:03:33 +02:00
|
|
|
package DateiKopieren;
|
2016-10-17 06:30:35 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @author simonr
|
|
|
|
*/
|
2016-10-26 15:03:33 +02:00
|
|
|
import forgemodpackbuilder.GUI;
|
2016-10-17 06:30:35 +02:00
|
|
|
import java.io.File;
|
|
|
|
import java.io.FileInputStream;
|
|
|
|
import java.io.FileOutputStream;
|
|
|
|
import java.io.IOException;
|
|
|
|
import java.nio.channels.FileChannel;
|
|
|
|
|
|
|
|
public class DateiKopierenClass1 {
|
|
|
|
|
|
|
|
public static void main(String[] args) throws IOException {
|
|
|
|
File inF = new File(GUI.datei);
|
|
|
|
File outF = new File("./modpack/modpack/" + GUI.datei.substring( GUI.datei.lastIndexOf( "/" ) + 1 ));
|
|
|
|
copyFile(inF, outF);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void copyFile(File in, File out) throws IOException {
|
|
|
|
FileChannel inChannel = null;
|
|
|
|
FileChannel outChannel = null;
|
|
|
|
try {
|
|
|
|
inChannel = new FileInputStream(in).getChannel();
|
|
|
|
outChannel = new FileOutputStream(out).getChannel();
|
|
|
|
inChannel.transferTo(0, inChannel.size(), outChannel);
|
|
|
|
} catch (IOException e) {
|
|
|
|
throw e;
|
|
|
|
} finally {
|
|
|
|
try {
|
|
|
|
if (inChannel != null)
|
|
|
|
inChannel.close();
|
|
|
|
if (outChannel != null)
|
|
|
|
outChannel.close();
|
|
|
|
} catch (IOException e) {}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|