01: /**
02: *
03: * © Copyright International Business Machines Corporation 2006.
04: * All rights reserved.
05: *
06: * The 'RuntimeUtilities' class provides runtime utilities.
07: *
08: * File : RuntimeUtilities.java
09: * Created : 2006/03/09
10: *
11: * @author Rene Pawlitzek (rpa@zurich.ibm.com)
12: * @version 2.00, 2006/03/09
13: * @since JDK 1.3
14: *
15: * History : 2006/03/09, rpa, new file
16: * 2006/03/14, rpa, code review
17: *
18: */package com.ibm.hamlet;
19:
20: import java.io.*;
21: import org.xml.sax.*;
22:
23: public class RuntimeUtilities {
24:
25: public static void printInclude(PrintWriter out, InputStream in)
26: throws Exception {
27: if (in == null)
28: return;
29: BufferedReader r = new BufferedReader(new InputStreamReader(in));
30: String line = r.readLine();
31: while (line != null) {
32: out.print(line);
33: line = r.readLine();
34: if (line != null)
35: out.println();
36: } // while
37: r.close();
38: in.close();
39: } // printInclude
40:
41: public static void printTag(PrintWriter out, String name,
42: Attributes atts) {
43: out.print("<");
44: out.print(name);
45: for (int i = 0; i < atts.getLength(); i++) {
46: out.print(" ");
47: out.print(atts.getLocalName(i));
48: out.print("=\"");
49: out.print(atts.getValue(i));
50: out.print("\"");
51: } // for
52: out.print(">");
53: } // printTag
54:
55: public static String getClassName(String templateName) {
56: int pos = templateName.lastIndexOf(".");
57: if (pos != -1)
58: templateName = templateName.substring(0, pos);
59: return templateName;
60: } // getClassName
61:
62: } // RuntimeUtilities
63:
64: /* ----- End of File ----- */
|