use of com.tom_roush.pdfbox.pdmodel.common.COSDictionaryMap in project PdfBox-Android by TomRoush.
the class PDAppearanceEntry method getSubDictionary.
/**
* Returns the entry as an appearance subdictionary.
*
* @throws IllegalStateException if this entry is not an appearance subdictionary
*/
public Map<COSName, PDAppearanceStream> getSubDictionary() {
if (!isSubDictionary()) {
throw new IllegalStateException("This entry is not an appearance subdictionary");
}
COSDictionary dict = (COSDictionary) entry;
Map<COSName, PDAppearanceStream> map = new HashMap<COSName, PDAppearanceStream>();
for (COSName name : dict.keySet()) {
COSBase value = dict.getDictionaryObject(name);
// the file from PDFBOX-1599 contains /null as its entry, so we skip non-stream entries
if (value instanceof COSStream) {
map.put(name, new PDAppearanceStream((COSStream) value));
}
}
return new COSDictionaryMap<COSName, PDAppearanceStream>(map, dict);
}
Aggregations