blob: 25659de2a6b5563d5ba075a906aaae895b1bc683 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
package org.archphantom.shenanigans.examples;
import java.io.FileOutputStream;
import java.io.ObjectOutputStream;
import java.util.Scanner;
import org.archphantom.shenanigans.elements.Program;
public class Exporter {
public static void main (String[] args) {
Program addit = AddIt.buildExample();
Program checkit = CheckIt.buildExample();
Program factorial = Factorial.buildExample();
Program factorialz = FactorialZ.buildExample();
Program nsaccess = NamespaceAccess.buildExample();
Program shiftit = ShiftIt.buildExample();
Scanner s = new Scanner(System.in);
System.out.println("Export AddIt To:");
writeToFile(addit, s.nextLine());
System.out.println("Export CheckIt To:");
writeToFile(checkit, s.nextLine());
System.out.println("Export Factorial To:");
writeToFile(factorial, s.nextLine());
System.out.println("Export FactorialZ To:");
writeToFile(factorialz, s.nextLine());
System.out.println("Export NamespaceAccess To:");
writeToFile(nsaccess, s.nextLine());
System.out.println("Export ShiftIt To:");
writeToFile(shiftit, s.nextLine());
s.close();
System.out.println("Export complete.");
}
public static void writeToFile (Program program, String filename) {
try {
ObjectOutputStream stream = new ObjectOutputStream(new FileOutputStream(filename));
stream.writeObject(program);
stream.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
|