PDFMultimediaUtil.java
2.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/*
* Decompiled with CFR 0_118.
*
* Could not load the following classes:
* com.adobe.internal.pdftoolkit.core.cos.CosObject
* com.adobe.internal.pdftoolkit.core.exceptions.PDFInvalidParameterException
* com.adobe.internal.pdftoolkit.core.exceptions.PDFRuntimeException
*/
package com.adobe.internal.pdftoolkit.pdf.interactive.annotation;
import com.adobe.internal.pdftoolkit.core.cos.CosObject;
import com.adobe.internal.pdftoolkit.core.exceptions.PDFInvalidParameterException;
import com.adobe.internal.pdftoolkit.core.exceptions.PDFRuntimeException;
import com.adobe.internal.pdftoolkit.pdf.document.PDFCosDictionary;
import com.adobe.internal.pdftoolkit.pdf.document.PDFDocument;
import java.lang.reflect.Method;
import java.util.HashMap;
public class PDFMultimediaUtil {
public static final String MULTIMEDIA_PACKAGENAME = "com.adobe.internal.pdftoolkit.pdf.multimedia";
private static HashMap<String, Method> constructorWithCosobjectMap = new HashMap();
private static HashMap<String, Method> constructorWithPDFDocMap = new HashMap();
public static PDFCosDictionary createPDFMultimediaObject(String className, PDFDocument pdfdoc) {
try {
Method m = constructorWithPDFDocMap.get(className);
if (m == null) {
Class clazz = Class.forName("com.adobe.internal.pdftoolkit.pdf.multimedia." + className);
m = clazz.getDeclaredMethod("newInstance", PDFDocument.class);
constructorWithPDFDocMap.put(className, m);
}
return (PDFCosDictionary)m.invoke(null, pdfdoc);
}
catch (Exception e) {
throw new PDFRuntimeException("Could not load class com.adobe.internal.pdftoolkit.pdf.multimedia." + className + " at runtime.", (Throwable)e);
}
}
public static PDFCosDictionary createPDFMultimediaObject(String className, CosObject cosobject) {
try {
Method m = constructorWithCosobjectMap.get(className);
if (m == null) {
Class clazz = Class.forName("com.adobe.internal.pdftoolkit.pdf.multimedia." + className);
m = clazz.getDeclaredMethod("getInstance", CosObject.class);
constructorWithCosobjectMap.put(className, m);
}
return (PDFCosDictionary)m.invoke(null, new Object[]{cosobject});
}
catch (Exception e) {
throw new PDFRuntimeException("Could not load class com.adobe.internal.pdftoolkit.pdf.multimedia." + className + " at runtime.", (Throwable)e);
}
}
public static void checkParameterType(String className, Object object) throws PDFInvalidParameterException {
if (!object.getClass().getName().equals(className)) {
throw new PDFInvalidParameterException("Expected parameter " + object + " to be of type " + className);
}
}
}