1 7 8 package org.jboss.media.format.image.iio; 9 10 import javax.emb.MediaHeader; 11 import javax.imageio.metadata.IIOMetadata ; 12 13 import org.jboss.media.util.DOMUtils; 14 import org.w3c.dom.Node ; 15 16 23 public abstract class IIOMediaHeader implements MediaHeader 24 { 25 protected IIOMetadata imageMetadata; 26 protected Node metadataRootNode; 27 28 34 public IIOMediaHeader(IIOMetadata imageMetadata, String formatName) 35 { 36 this.imageMetadata = imageMetadata; 37 this.metadataRootNode = imageMetadata.getAsTree(formatName); 38 } 39 40 43 public abstract String [] getFieldNames(); 44 45 48 public abstract Object getField(String fieldname); 49 50 protected Node getNode(String node) 51 { 52 return getNode(metadataRootNode, node); 53 } 54 55 protected Node getNode(Node parentNode, String node) 56 { 57 return DOMUtils.findNode(parentNode, node); 58 } 59 60 protected String getAttribute(String node, String attribute) 61 { 62 return getAttribute(getNode(node), attribute); 63 } 64 65 protected String getAttribute(Node node, String attribute) 66 { 67 return DOMUtils.getNodeAttribute(node, attribute); 68 } 69 } 70 | Popular Tags |