PDFAnnotationList.java
6.02 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
/*
* Decompiled with CFR 0_118.
*
* Could not load the following classes:
* com.adobe.internal.pdftoolkit.core.cos.CosArray
* com.adobe.internal.pdftoolkit.core.cos.CosObject
* com.adobe.internal.pdftoolkit.core.exceptions.PDFCosParseException
* com.adobe.internal.pdftoolkit.core.exceptions.PDFIOException
* com.adobe.internal.pdftoolkit.core.exceptions.PDFInvalidDocumentException
* com.adobe.internal.pdftoolkit.core.exceptions.PDFSecurityException
*/
package com.adobe.internal.pdftoolkit.pdf.interactive.annotation;
import com.adobe.internal.pdftoolkit.core.cos.CosArray;
import com.adobe.internal.pdftoolkit.core.cos.CosObject;
import com.adobe.internal.pdftoolkit.core.exceptions.PDFCosParseException;
import com.adobe.internal.pdftoolkit.core.exceptions.PDFIOException;
import com.adobe.internal.pdftoolkit.core.exceptions.PDFInvalidDocumentException;
import com.adobe.internal.pdftoolkit.core.exceptions.PDFSecurityException;
import com.adobe.internal.pdftoolkit.pdf.document.PDFCosArrayList;
import com.adobe.internal.pdftoolkit.pdf.document.PDFCosObject;
import com.adobe.internal.pdftoolkit.pdf.document.PDFCosObjectContainer;
import com.adobe.internal.pdftoolkit.pdf.document.PDFDocument;
import com.adobe.internal.pdftoolkit.pdf.interactive.annotation.PDFAnnotation;
import com.adobe.internal.pdftoolkit.pdf.interactive.annotation.PDFAnnotationFactory;
import com.adobe.internal.pdftoolkit.pdf.interactive.annotation.PDFAnnotationIterator;
import java.util.Iterator;
import java.util.List;
public class PDFAnnotationList
extends PDFCosObject {
PDFAnnotationArrayList mAnnotationArrayList;
private PDFAnnotationList(CosObject cosObject) throws PDFInvalidDocumentException {
super(cosObject);
this.mAnnotationArrayList = new PDFAnnotationArrayList(cosObject);
}
public static PDFAnnotationList getInstance(CosObject cosObject) throws PDFInvalidDocumentException {
if (PDFCosObject.checkNullCosObject(cosObject) == null) {
return null;
}
PDFAnnotationList pdfObject = PDFCosObject.getCachedInstance(cosObject, PDFAnnotationList.class);
if (pdfObject == null) {
pdfObject = new PDFAnnotationList(cosObject);
}
return pdfObject;
}
public static PDFAnnotationList newInstance(PDFDocument pdfDocument) throws PDFInvalidDocumentException, PDFIOException, PDFSecurityException {
CosArray cosObject = PDFCosObject.newCosArray(pdfDocument);
PDFAnnotationList pdfObject = new PDFAnnotationList((CosObject)cosObject);
return pdfObject;
}
public PDFAnnotation findAnnotation(String name) throws PDFInvalidDocumentException, PDFIOException, PDFSecurityException {
PDFAnnotation curAnnot = null;
int annotInd = 0;
for (annotInd = 0; annotInd < this.size(); ++annotInd) {
curAnnot = this.get(annotInd);
if (curAnnot == null || !name.equals(curAnnot.getName())) continue;
return curAnnot;
}
return null;
}
public List getArrayList() {
return this.mAnnotationArrayList;
}
public void add(int index, PDFAnnotation element) {
this.mAnnotationArrayList.add(index, element);
}
public boolean add(PDFAnnotation o) {
return this.mAnnotationArrayList.add(o);
}
public void addAnnotations(PDFAnnotationList annots) {
this.mAnnotationArrayList.addList((PDFCosArrayList)annots.getArrayList());
}
public void clear() {
this.mAnnotationArrayList.clear();
}
public boolean contains(PDFAnnotation o) {
return this.mAnnotationArrayList.contains(o);
}
public PDFAnnotation get(int index) {
return (PDFAnnotation)this.mAnnotationArrayList.get(index);
}
public int indexOf(PDFAnnotation o) {
return this.mAnnotationArrayList.indexOf(o);
}
public boolean isEmpty() {
return this.mAnnotationArrayList.isEmpty();
}
public PDFAnnotationIterator iterator() {
return new PDFAnnotationListIterator(this.mAnnotationArrayList);
}
public int lastIndexOf(PDFAnnotation o) {
return this.mAnnotationArrayList.lastIndexOf(o);
}
public PDFAnnotation remove(int index) {
return (PDFAnnotation)this.mAnnotationArrayList.remove(index);
}
public boolean remove(PDFAnnotation o) {
return this.mAnnotationArrayList.remove(o);
}
public PDFAnnotation set(int index, PDFAnnotation element) {
return this.mAnnotationArrayList.set(index, element);
}
public int size() {
return this.mAnnotationArrayList.size();
}
public PDFAnnotation[] toArray() {
Object[] theArray = new PDFAnnotation[this.mAnnotationArrayList.size()];
return (PDFAnnotation[])this.mAnnotationArrayList.toArray(theArray);
}
public PDFAnnotation[] toArray(PDFAnnotation[] a) {
return (PDFAnnotation[])this.mAnnotationArrayList.toArray(a);
}
static class PDFAnnotationListIterator
implements PDFAnnotationIterator {
Iterator<PDFAnnotation> mAnnotsIter;
PDFAnnotationListIterator(PDFAnnotationArrayList annotationArrayList) {
this.mAnnotsIter = annotationArrayList.iterator();
}
public boolean hasNext() {
return this.mAnnotsIter.hasNext();
}
public PDFAnnotation next() {
return this.mAnnotsIter.next();
}
public void remove() {
this.mAnnotsIter.remove();
}
}
/*
* This class specifies class file version 49.0 but uses Java 6 signatures. Assumed Java 6.
*/
static class PDFAnnotationArrayList
extends PDFCosArrayList<PDFAnnotation> {
private PDFAnnotationArrayList(CosObject cosObject) throws PDFInvalidDocumentException {
super(cosObject);
}
@Override
protected PDFAnnotation itemInstantiator(CosObject cosObject) throws PDFCosParseException, PDFInvalidDocumentException, PDFIOException, PDFSecurityException {
return PDFAnnotationFactory.getInstance(cosObject);
}
}
}