KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > caucho > jsp > AbstractJspWriter


1 /*
2  * Copyright (c) 1998-2006 Caucho Technology -- all rights reserved
3  *
4  * This file is part of Resin(R) Open Source
5  *
6  * Each copy or derived work must preserve the copyright notice and this
7  * notice unmodified.
8  *
9  * Resin Open Source is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * Resin Open Source is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, or any warranty
17  * of NON-INFRINGEMENT. See the GNU General Public License for more
18  * details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with Resin Open Source; if not, write to the
22  * Free SoftwareFoundation, Inc.
23  * 59 Temple Place, Suite 330
24  * Boston, MA 02111-1307 USA
25  *
26  * @author Scott Ferguson
27  */

28
29 package com.caucho.jsp;
30
31 import com.caucho.log.Log;
32 import com.caucho.vfs.FlushBuffer;
33
34 import javax.servlet.jsp.JspWriter JavaDoc;
35 import javax.servlet.jsp.tagext.BodyContent JavaDoc;
36 import java.io.IOException JavaDoc;
37 import java.io.Reader JavaDoc;
38 import java.io.Writer JavaDoc;
39 import java.util.logging.Logger JavaDoc;
40
41 /**
42  * A buffered JSP writer encapsulating a Writer.
43  */

44 abstract class AbstractJspWriter extends BodyContent JavaDoc implements FlushBuffer {
45   protected static final Logger JavaDoc log = Log.open(AbstractJspWriter.class);
46   private JspWriter JavaDoc _parent;
47
48   // the underlying writer
49
private Writer JavaDoc _writer;
50
51   /**
52    * Creates a new QJspWriter
53    */

54   AbstractJspWriter()
55   {
56     super(null);
57
58     this.autoFlush = true;
59   }
60
61   /**
62    * Creates a new QJspWriter
63    */

64   AbstractJspWriter(int bufferSize, boolean isAutoFlush)
65   {
66     super(null);
67
68     this.bufferSize = bufferSize;
69     this.autoFlush = isAutoFlush;
70   }
71
72   /**
73    * Sets the parent.
74    */

75   public void setParent(JspWriter JavaDoc parent)
76   {
77     _parent = parent;
78   }
79
80   /**
81    * Returns the parent JSP writer.
82    */

83   public final JspWriter JavaDoc getEnclosingWriter()
84   {
85     return _parent;
86   }
87
88   public void writeOut(Writer JavaDoc writer) throws IOException JavaDoc
89   {
90     throw new UnsupportedOperationException JavaDoc();
91   }
92
93   public String JavaDoc getString()
94   {
95     throw new UnsupportedOperationException JavaDoc();
96   }
97
98   public Reader JavaDoc getReader()
99   {
100     throw new UnsupportedOperationException JavaDoc();
101   }
102
103   public void clearBody()
104   {
105     throw new UnsupportedOperationException JavaDoc();
106   }
107
108   /**
109    * Returns the autoFlush flag.
110    */

111   final public boolean isAutoFlush()
112   {
113     return this.autoFlush;
114   }
115
116   /**
117    * Pops the enclosing writer.
118    */

119   AbstractJspWriter popWriter()
120   {
121     return (AbstractJspWriter) _parent;
122   }
123 }
124
Popular Tags