DEADSOFTWARE

License project under GNU GPL 3.
[LongFlight.git] / Crypto / src / code / kalter / longflight / crypto / Crypto.java
1 package code.kalter.longflight.crypto;
3 import java.io.FileInputStream;
4 import java.io.FileNotFoundException;
5 import java.io.FileOutputStream;
6 import java.io.IOException;
7 import java.io.InputStream;
8 import java.io.OutputStream;
10 /**
11 * Главный класс
12 *
13 * @author Kalter
14 */
15 public class Crypto {
17 public static void main(String[] args) throws IOException {
18 final String iname = args[0];
19 final String oname = args[1];
20 final int key = Integer.parseInt(args[2], 16);
21 try (InputStream fistream = new CIStream(new FileInputStream(iname), key);
22 OutputStream fostream = new FileOutputStream("_" + oname);) {
23 while (fistream.available() > 0) {
24 fostream.write(fistream.read());
25 }
26 } catch (FileNotFoundException e) {
27 System.out.println("File not found");
28 e.printStackTrace();
29 } catch (IOException e) {
30 System.out.println("I/O error");
31 }
32 }
33 }