KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > fop > render > afp > modca > AbstractAFPObject


1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License. You may obtain a copy of the License at
8  *
9  * 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
18 /* $Id: AbstractAFPObject.java 426576 2006-07-28 15:44:37Z jeremias $ */
19
20 package org.apache.fop.render.afp.modca;
21
22 import java.io.IOException JavaDoc;
23 import java.io.OutputStream JavaDoc;
24 import java.util.Iterator JavaDoc;
25 import java.util.List JavaDoc;
26
27 import org.apache.commons.logging.Log;
28 import org.apache.commons.logging.LogFactory;
29
30 /**
31  * This is the base class for all data stream objects. Page objects are
32  * responsible for building and generating the binary datastream in an
33  * AFP format.
34  *
35  */

36 public abstract class AbstractAFPObject {
37
38     /**
39      * Static logging instance
40      */

41     protected static final Log log = LogFactory.getLog("org.apache.fop.render.afp.modca");
42
43     /**
44      * DataStream objects must implement the writeDataStream()
45      * method to write its data to the given OutputStream
46      * @param os The outputsteam stream
47      * @throws java.io.IOException
48      */

49     public abstract void writeDataStream(OutputStream JavaDoc os) throws IOException JavaDoc;
50
51     /**
52      * Help method to write a set of AFPObjects to the AFP datastream.
53      * @afpObjects a list of AFPObjects
54      * @param os The stream to write to
55      * @throws java.io.IOException
56      */

57     protected void writeObjectList(List JavaDoc afpObjects, OutputStream JavaDoc os)
58         throws IOException JavaDoc {
59
60         for (Iterator JavaDoc it = afpObjects.iterator(); it.hasNext(); ) {
61             ((AbstractAFPObject)it.next()).writeDataStream(os);
62         }
63
64     }
65
66 }
67
Popular Tags