1
2
3
4
5
6
7
8
9
10
11
12
13
14 package olg.csv.bean;
15
16 import java.io.File;
17 import java.io.FileNotFoundException;
18 import java.io.FileOutputStream;
19 import java.io.IOException;
20 import java.io.InputStream;
21
22
23
24
25
26
27
28 public final class SchemaMain {
29
30
31
32
33 public static final String BASE_NAMESPACE_MAPPING = "http://www.example.org/row-bean";
34
35
36
37
38 private SchemaMain() {
39
40 }
41
42
43
44
45
46
47
48
49 public static void main(String[] args) {
50 System.out.println("Copy of bean-row.xsd ...");
51
52
53 File destination = new File("bean-row.xsd");
54
55 InputStream input = null;
56 java.io.FileOutputStream destinationFile = null;
57 try {
58
59 input = Util.class.getResourceAsStream("bean-row.xsd");
60 destinationFile = new FileOutputStream(destination);
61
62 byte[] buffer = new byte[512 * 1024];
63 int nbLecture;
64
65 while ((nbLecture = input.read(buffer)) != -1) {
66
67
68 destinationFile.write(buffer, 0, nbLecture);
69 }
70
71 System.out.println("Done");
72 System.out.println("See your copy " + destination.getAbsolutePath());
73
74
75
76
77
78 System.out.println("Don't forget to declare the following namespace in your XML Declaration :"
79 + BASE_NAMESPACE_MAPPING);
80
81 } catch (FileNotFoundException e) {
82
83 e.printStackTrace();
84 } catch (IOException e) {
85
86 e.printStackTrace();
87 } finally {
88 if (destinationFile != null) {
89 try {
90 destinationFile.close();
91 } catch (IOException ex) {
92 ex.printStackTrace();
93 }
94 }
95
96 if (input != null) {
97 try {
98 input.close();
99 } catch (IOException ex) {
100 ex.printStackTrace();
101 }
102 }
103
104 }
105
106 }
107 }