KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > opensymphony > module > sitemesh > parser > TokenizedHTMLPage


1 package com.opensymphony.module.sitemesh.parser;
2
3 import com.opensymphony.module.sitemesh.html.util.CharArray;
4
5 import java.io.IOException JavaDoc;
6 import java.io.Writer JavaDoc;
7
8 /**
9  * HTMLPage implementation that builds itself based on the incoming 'tag' and 'text' tokens fed to it from the
10  * HTMLTagTokenizer.
11  *
12  * @see com.opensymphony.module.sitemesh.parser.HTMLPageParser
13  * @see com.opensymphony.module.sitemesh.html.tokenizer.TagTokenizer
14  *
15  * @author Joe Walnes
16  */

17 public class TokenizedHTMLPage extends AbstractHTMLPage {
18
19     private CharArray body;
20     private CharArray head;
21
22     public TokenizedHTMLPage(char[] original, CharArray body, CharArray head) {
23         this.pageData = original;
24         this.body = body;
25         this.head = head;
26         addProperty("title", "");
27     }
28
29     public void writeHead(Writer JavaDoc out) throws IOException JavaDoc {
30         out.write(head.toString());
31     }
32
33     public void writeBody(Writer JavaDoc out) throws IOException JavaDoc {
34         out.write(body.toString());
35     }
36
37     public String JavaDoc getHead() {
38         return head.toString();
39     }
40
41     public String JavaDoc getBody() {
42         return body.toString();
43     }
44
45     public String JavaDoc getPage() {
46         return new String JavaDoc(pageData);
47     }
48
49 }
50
Popular Tags