1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.xnap.pkg;
21
22 import java.io.BufferedWriter;
23 import java.io.IOException;
24 import java.util.Iterator;
25 import java.util.Properties;
26 import java.util.StringTokenizer;
27
28 /***
29 *
30 */
31 public class PackageInfoWriter
32 {
33
34
35
36
37
38
39
40
41
42 public static void write(BufferedWriter out, Properties p)
43 throws IOException
44 {
45 for (Iterator i = p.keySet().iterator(); i.hasNext();) {
46 String key = (String)i.next();
47 out.write(key + ": ");
48
49 String value = p.getProperty(key);
50 if (value.length() == 0) {
51 out.write("\n");
52 }
53 else {
54 StringTokenizer t = new StringTokenizer(value, "\n", true);
55 while (t.hasMoreTokens()) {
56 String line = t.nextToken();
57 if (line.equals("\n")) {
58 out.write(" .\n");
59 }
60 else {
61 out.write(line + "\n");
62 }
63 }
64 }
65 }
66 out.write("\n");
67 out.flush();
68 }
69
70 }
71