/** Read the component mapping channel. */ public void readComponentMappingBox(int length)throws IOException { int num = length / 4; comps = new short[num]; type = new byte[num]; maps = new byte[num]; for (int i = 0; i < num; i++) { comps[i] = in.readShort(); type[i] = in.readByte(); maps[i] = in.readByte(); } if (metadata != null) { metadata.addNode(new ComponentMappingBox(comps, type, maps)); } }
/** Creates an <code>IIOMetadataNode</code> from this component mapping * box. The format of this node is defined in the XML dtd and xsd * for the JP2 image file. */ public IIOMetadataNode getNativeNode() { IIOMetadataNode node = new IIOMetadataNode(Box.getName(getType())); setDefaultAttributes(node); for (int i = 0; i < components.length; i++) { IIOMetadataNode child = new IIOMetadataNode("Component"); Short obj = new Short(components[i]); child.setUserObject(new Short(components[i])); child.setNodeValue("" + components[i]); node.appendChild(child); child = new IIOMetadataNode("ComponentType"); child.setUserObject(new Byte(type[i])); child.setNodeValue("" + type[i]); node.appendChild(child); child = new IIOMetadataNode("ComponentAssociation"); child.setUserObject(new Byte(map[i])); child.setNodeValue("" + map[i]); node.appendChild(child); } return node; }
maps[i] = (byte)i; addNode(new ComponentMappingBox(channels, types, maps));