01: package it.geosolutions.imageio.plugins.jhdf;
02:
03: import java.util.Iterator;
04: import java.util.Map;
05: import java.util.Set;
06:
07: import javax.imageio.metadata.IIOMetadata;
08: import javax.imageio.metadata.IIOMetadataNode;
09:
10: public abstract class BaseHDFStreamMetadata extends IIOMetadata {
11:
12: public BaseHDFStreamMetadata(
13: boolean standardMetadataFormatSupported,
14: String nativeMetadataFormatName,
15: String nativeMetadataFormatClassName,
16: String[] extraMetadataFormatNames,
17: String[] extraMetadataFormatClassNames) {
18: super (standardMetadataFormatSupported,
19: nativeMetadataFormatName,
20: nativeMetadataFormatClassName,
21: extraMetadataFormatNames, extraMetadataFormatClassNames);
22: }
23:
24: /**
25: * Build a node having name <code>nodeName</code> and attributes retrieved
26: * from the provided <code>attribMap</code>.
27: *
28: * @param attribMap
29: * A <code>Map</code> containing couples (attrib name, attrib value)
30: * @param nodeName
31: * the name which need to be set for the node.
32: * @return
33: * the built node.
34: */
35: protected IIOMetadataNode buildAttributesNodeFromMap(
36: final Map attribMap, final String nodeName) {
37: final IIOMetadataNode node = new IIOMetadataNode(nodeName);
38: synchronized (attribMap) {
39: if (attribMap != null) {
40: final Set set = attribMap.keySet();
41: final Iterator iter = set.iterator();
42: while (iter.hasNext()) {
43: final String key = (String) iter.next();
44: final String attribValue = (String) attribMap
45: .get(key);
46: node.setAttribute(key, attribValue);
47: }
48: }
49: }
50: return node;
51: }
52:
53: }
|