1 2 17 18 package org.apache.poi.hpsf.wellknown; 19 20 import java.util.HashMap ; 21 22 41 public class SectionIDMap extends HashMap 42 { 43 44 47 public static final byte[] SUMMARY_INFORMATION_ID = new byte[] 48 { 49 (byte) 0xF2, (byte) 0x9F, (byte) 0x85, (byte) 0xE0, 50 (byte) 0x4F, (byte) 0xF9, (byte) 0x10, (byte) 0x68, 51 (byte) 0xAB, (byte) 0x91, (byte) 0x08, (byte) 0x00, 52 (byte) 0x2B, (byte) 0x27, (byte) 0xB3, (byte) 0xD9 53 }; 54 55 60 public static final byte[] DOCUMENT_SUMMARY_INFORMATION_ID = new byte[] 61 { 62 (byte) 0xD5, (byte) 0xCD, (byte) 0xD5, (byte) 0x02, 63 (byte) 0x2E, (byte) 0x9C, (byte) 0x10, (byte) 0x1B, 64 (byte) 0x93, (byte) 0x97, (byte) 0x08, (byte) 0x00, 65 (byte) 0x2B, (byte) 0x2C, (byte) 0xF9, (byte) 0xAE 66 }; 67 68 71 public static final String UNDEFINED = "[undefined]"; 72 73 77 private static SectionIDMap defaultMap; 78 79 80 81 87 public static SectionIDMap getInstance() 88 { 89 if (defaultMap == null) 90 { 91 final SectionIDMap m = new SectionIDMap(); 92 m.put(SUMMARY_INFORMATION_ID, 93 PropertyIDMap.getSummaryInformationProperties()); 94 m.put(DOCUMENT_SUMMARY_INFORMATION_ID, 95 PropertyIDMap.getDocumentSummaryInformationProperties()); 96 defaultMap = m; 97 } 98 return defaultMap; 99 } 100 101 102 103 116 public static String getPIDString(final byte[] sectionFormatID, 117 final long pid) 118 { 119 final PropertyIDMap m = 120 (PropertyIDMap) getInstance().get(sectionFormatID); 121 if (m == null) 122 return UNDEFINED; 123 else 124 { 125 final String s = (String ) m.get(pid); 126 if (s == null) 127 return UNDEFINED; 128 return s; 129 } 130 } 131 132 133 134 141 public PropertyIDMap get(final byte[] sectionFormatID) 142 { 143 return (PropertyIDMap) super.get(new String (sectionFormatID)); 144 } 145 146 147 148 156 public Object get(final Object sectionFormatID) 157 { 158 return get((byte[]) sectionFormatID); 159 } 160 161 162 163 171 public Object put(final byte[] sectionFormatID, 172 final PropertyIDMap propertyIDMap) 173 { 174 return super.put(new String (sectionFormatID), propertyIDMap); 175 } 176 177 178 179 190 public Object put(final Object key, final Object value) 191 { 192 return put((byte[]) key, (PropertyIDMap) value); 193 } 194 195 } 196 | Popular Tags |