KickJava   Java API By Example, From Geeks To Geeks.

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


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: EndPageGroup.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.io.UnsupportedEncodingException JavaDoc;
25
26 /**
27  * The End Named Page Group (ENG) structured field terminates a page group that was
28  * initiated by a Begin Named Page Group structured field.
29  *
30  * Note :This object will be used to represent an ENG
31  * structured field. It is necessary as you can't end
32  * a PageGroup because you don't know where the group
33  * will end (as this is controlled by the tags in the FO).
34  * <p>
35  *
36  */

37 public class EndPageGroup extends AbstractNamedAFPObject {
38
39     public EndPageGroup(String JavaDoc groupId) {
40
41         super(groupId);
42
43         log.debug("A ENG is being created for group: " + groupId);
44
45     }
46
47     /**
48      * Accessor method to write the AFP datastream for the End Page Group.
49      * @param os The stream to write to
50      * @throws java.io.IOException
51      */

52     public void writeDataStream(OutputStream JavaDoc os)
53         throws IOException JavaDoc {
54         byte[] data = new byte[17];
55
56         data[0] = 0x5A; // Structured field identifier
57
data[1] = 0x00; // Length byte 1
58
data[2] = 0x10; // Length byte 2
59
data[3] = (byte) 0xD3; // Structured field id byte 1
60
data[4] = (byte) 0xA9; // Structured field id byte 2
61
data[5] = (byte) 0xAD; // Structured field id byte 3
62
data[6] = 0x00; // Flags
63
data[7] = 0x00; // Reserved
64
data[8] = 0x00; // Reserved
65

66         for (int i = 0; i < _nameBytes.length; i++) {
67
68             data[9 + i] = _nameBytes[i];
69
70         }
71
72         os.write(data);
73     }
74
75 }
76
Popular Tags