Delete AutoUpdate.java

This commit is contained in:
CrazyCloudCraft | Argantiu 2022-10-10 08:50:21 +02:00 committed by GitHub
parent 71691bab29
commit 75d393e211
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,53 +0,0 @@
package de.butzlabben.world.autoupdater;
import java.io.FileOutputStream;
import java.io.IOException;
import java.net.URL;
import java.nio.channels.Channels;
import java.nio.channels.FileChannel;
import java.nio.channels.ReadableByteChannel;
/**
* @author Butzlabben
* @since 02.05.2018
*/
public class AutoUpdate implements Runnable {
private final UpdateInformations ui;
private final String jar;
protected AutoUpdate(UpdateInformations ui, String jar) {
this.ui = ui;
this.jar = jar;
}
@Override
public void run() {
FileChannel out = null;
FileOutputStream outStream = null;
try {
ReadableByteChannel in = Channels
.newChannel(new URL(ui.getURL()).openStream());
outStream = new FileOutputStream(jar);
out = outStream.getChannel();
out.transferFrom(in, 0, Long.MAX_VALUE);
} catch (Exception e) {
e.printStackTrace();
} finally {
if (out != null)
try {
out.close();
} catch (IOException e) {
e.printStackTrace();
}
if (outStream != null) {
try {
outStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
}