KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > cocoon > serialization > AbstractSerializer


1 /*
2  * Copyright 1999-2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package org.apache.cocoon.serialization;
17
18 import org.apache.cocoon.xml.AbstractXMLPipe;
19 import java.io.IOException JavaDoc;
20 import java.io.OutputStream JavaDoc;
21
22 /**
23  * @author <a HREF="mailto:pier@apache.org">Pierpaolo Fumagalli</a>
24  * (Apache Software Foundation)
25  * @author <a HREF="mailto:stefano@apache.org">Stefano Mazzocchi</a>
26  * @version CVS $Id: AbstractSerializer.java 30932 2004-07-29 17:35:38Z vgritsenko $
27  */

28
29 public abstract class AbstractSerializer
30 extends AbstractXMLPipe implements Serializer {
31
32     /**
33      * The <code>OutputStream</code> used by this serializer.
34      */

35     protected OutputStream JavaDoc output;
36
37     /**
38      * Set the {@link OutputStream} where the requested resource should
39      * be serialized.
40      */

41     public void setOutputStream(OutputStream JavaDoc out)
42     throws IOException JavaDoc {
43         this.output = out;
44     }
45
46     /**
47      * Get the mime-type of the output of this <code>Serializer</code>
48      * This default implementation returns null to indicate that the
49      * mime-type specified in the sitemap is to be used
50      */

51     public String JavaDoc getMimeType() {
52         return null;
53     }
54
55     /**
56      * Recycle serializer by removing references
57      */

58     public void recycle() {
59         super.recycle();
60         this.output = null;
61     }
62
63     /**
64      * Test if the component wants to set the content length
65      */

66     public boolean shouldSetContentLength() {
67         return false;
68     }
69
70 }
71
Popular Tags