From 490f1d2cbb0b546c3d739d1fb192526d466ada39 Mon Sep 17 00:00:00 2001 From: Gerhard Switalski Date: Sat, 15 Dec 2018 11:33:35 +0100 Subject: [PATCH] =?UTF-8?q?Start=20Klasse=20aufger=C3=A4umt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/chatprogramm/Start.java | 47 ++----------------------------------- 1 file changed, 2 insertions(+), 45 deletions(-) diff --git a/src/chatprogramm/Start.java b/src/chatprogramm/Start.java index 8a5ff57..a38a647 100644 --- a/src/chatprogramm/Start.java +++ b/src/chatprogramm/Start.java @@ -6,42 +6,14 @@ package chatprogramm; -import java.io.BufferedInputStream; -import java.io.BufferedOutputStream; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.net.MalformedURLException; -import java.net.URL; - /** * Builder Class * @author le */ public class Start { - public Start(String urlString, String dateiname) throws MalformedURLException, IOException + public Start() { - URL oUrl = new URL(urlString + "/" + dateiname); - InputStream iStream = oUrl.openStream(); - BufferedInputStream in = new BufferedInputStream(iStream); - - String tmpVerzeichnis = System.getProperty("java.io.tmpdir"); - String ausgabeDateiname = tmpVerzeichnis + File.separator + dateiname; - - FileOutputStream fos = new FileOutputStream(ausgabeDateiname); - BufferedOutputStream out = new BufferedOutputStream(fos); - - int wert = 0; - - while ( (wert = in.read()) >= 0) - { - out.write(wert); - } - in.close(); - out.close(); // flush! - System.out.println("Datei " + ausgabeDateiname + " erfolgreich erstellt"); } @@ -50,21 +22,6 @@ public class Start */ public static void main(String[] args) { - if (args.length != 2) - { - System.err.println("2 Aufrufparameter nötig: URL-String Dateiname"); - } - else - { - try - { - new Start(args[0], args[1]); - } - catch (Exception ex) - { - System.err.println(ex); - ex.printStackTrace(); - } - } + new Start(); } }