01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17: package org.apache.cocoon.serialization;
18:
19: import org.apache.cocoon.xml.AbstractXMLPipe;
20: import java.io.IOException;
21: import java.io.OutputStream;
22:
23: /**
24: * @author <a href="mailto:pier@apache.org">Pierpaolo Fumagalli</a>
25: * (Apache Software Foundation)
26: * @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
27: * @version CVS $Id: AbstractSerializer.java 452130 2006-10-02 17:17:06Z vgritsenko $
28: */
29:
30: public abstract class AbstractSerializer extends AbstractXMLPipe
31: implements Serializer {
32:
33: /**
34: * The <code>OutputStream</code> used by this serializer.
35: */
36: protected OutputStream output;
37:
38: /**
39: * Set the {@link OutputStream} where the requested resource should
40: * be serialized.
41: */
42: public void setOutputStream(OutputStream out) throws IOException {
43: this .output = out;
44: }
45:
46: /**
47: * Get the mime-type of the output of this <code>Serializer</code>
48: */
49: public String getMimeType() {
50: return null;
51: }
52:
53: /**
54: * Recycle serializer by removing references
55: */
56: public void recycle() {
57: super .recycle();
58: this .output = null;
59: }
60:
61: /**
62: * Test if the component wants to set the content length
63: */
64: public boolean shouldSetContentLength() {
65: return false;
66: }
67:
68: }
|