From: Adrian Cumiskey Date: Fri, 29 Aug 2008 15:24:21 +0000 (+0000) Subject: Added MapContainerData object. X-Git-Tag: fop-1_0~376^2~85 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=45aa720f980b61a92786c879ae6bc2443e17558c;p=xmlgraphics-fop.git Added MapContainerData object. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_AFPGOCAResources@690294 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/java/org/apache/fop/render/afp/modca/MapContainerData.java b/src/java/org/apache/fop/render/afp/modca/MapContainerData.java new file mode 100644 index 000000000..9ec157ee8 --- /dev/null +++ b/src/java/org/apache/fop/render/afp/modca/MapContainerData.java @@ -0,0 +1,57 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* $Id: $ */ + +package org.apache.fop.render.afp.modca; + +import java.io.IOException; +import java.io.OutputStream; + +import org.apache.fop.render.afp.modca.triplets.MappingOptionTriplet; +import org.apache.fop.render.afp.tools.BinaryUtils; + +/** + * The Map Container Data structured field specifies how a presentation data object + * that is carried in an Object Container is mapped into its object area. + */ +public class MapContainerData extends AbstractStructuredAFPObject { + + /** + * Main constructor + * + * @param optionValue the mapping option value + */ + public MapContainerData(byte optionValue) { + super.addTriplet(new MappingOptionTriplet(optionValue)); + } + + /** {@inheritDoc} */ + public void writeToStream(OutputStream os) throws IOException { + byte[] data = new byte[11]; + copySF(data, Type.MAP, Category.OBJECT_CONTAINER); + int tripletLen = getTripletDataLength(); + byte[] len = BinaryUtils.convert(10 + tripletLen, 2); + data[1] = len[0]; + data[2] = len[1]; + len = BinaryUtils.convert(2 + tripletLen, 2); + data[9] = len[0]; + data[10] = len[1]; + os.write(data); + os.write(tripletData); + } +}