Last active
August 29, 2015 14:19
-
-
Save 3c7/6ce476739ecbb1d51c69 to your computer and use it in GitHub Desktop.
Datenstrukturen und Algorithmen - Übungsblatt 3 - Aufgabe 5 (kein Praktomat upload notwendig)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.*; | |
public class FileCopy { | |
public static void main(String[] args) throws IOException { | |
try { | |
FileInputStream fis = new FileInputStream(args[0]); | |
FileOutputStream fos = new FileOutputStream(args[1]); | |
int c; | |
c = fis.read(); | |
while (c != -1) { | |
fos.write(c); | |
c = fis.read(); | |
} | |
fis.close(); | |
fos.close(); | |
} catch (ArrayIndexOutOfBoundsException aioobe) { | |
System.out.println("Bitte zwei Dateien angeben."); | |
} catch (IOException ioe) { | |
System.out.println("Datei nicht gefunden."); | |
} catch (Exception e) { | |
System.out.println(e.getMessage()); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment