CosArray.java
28.4 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
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
/*
* Decompiled with CFR 0_118.
*
* Could not load the following classes:
* com.adobe.internal.io.stream.InputByteStream
* com.adobe.internal.io.stream.OutputByteStream
*/
package com.adobe.internal.pdftoolkit.core.cos;
import com.adobe.internal.io.stream.InputByteStream;
import com.adobe.internal.io.stream.OutputByteStream;
import com.adobe.internal.pdftoolkit.core.cos.CosArrayValuesIterator;
import com.adobe.internal.pdftoolkit.core.cos.CosBoolean;
import com.adobe.internal.pdftoolkit.core.cos.CosContainer;
import com.adobe.internal.pdftoolkit.core.cos.CosContainerValuesIterator;
import com.adobe.internal.pdftoolkit.core.cos.CosDictionary;
import com.adobe.internal.pdftoolkit.core.cos.CosDocument;
import com.adobe.internal.pdftoolkit.core.cos.CosName;
import com.adobe.internal.pdftoolkit.core.cos.CosNull;
import com.adobe.internal.pdftoolkit.core.cos.CosNumeric;
import com.adobe.internal.pdftoolkit.core.cos.CosObject;
import com.adobe.internal.pdftoolkit.core.cos.CosObjectInfo;
import com.adobe.internal.pdftoolkit.core.cos.CosObjectRef;
import com.adobe.internal.pdftoolkit.core.cos.CosScalar;
import com.adobe.internal.pdftoolkit.core.cos.CosStream;
import com.adobe.internal.pdftoolkit.core.cos.CosString;
import com.adobe.internal.pdftoolkit.core.exceptions.PDFCosParseException;
import com.adobe.internal.pdftoolkit.core.exceptions.PDFException;
import com.adobe.internal.pdftoolkit.core.exceptions.PDFIOException;
import com.adobe.internal.pdftoolkit.core.exceptions.PDFSecurityException;
import com.adobe.internal.pdftoolkit.core.types.ASHexString;
import com.adobe.internal.pdftoolkit.core.types.ASName;
import com.adobe.internal.pdftoolkit.core.types.ASString;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.ListIterator;
import java.util.NoSuchElementException;
/*
* This class specifies class file version 49.0 but uses Java 6 signatures. Assumed Java 6.
*/
public class CosArray
extends CosContainer {
protected ArrayList<CosObject> mData;
protected CosArray(CosDocument doc, ArrayList data, CosObjectInfo info) {
super(doc, info);
this.mData = data;
if (!this.mData.isEmpty() && this.isIndirect()) {
for (CosObject obj : this.mData) {
if (obj.isIndirect()) continue;
if (obj instanceof CosString) {
((CosString)obj).setParentObj(this);
continue;
}
if (!(obj instanceof CosContainer)) continue;
((CosContainer)obj).setParentObj(this);
}
}
}
CosArray copy() throws PDFCosParseException, PDFIOException, PDFSecurityException {
if (this.isIndirect()) {
return this;
}
CosArray copy = this.getDocument().createCosArray(0);
Iterator<CosObject> iter = this.iterator();
while (iter.hasNext()) {
CosObject obj = iter.next();
if (!obj.isIndirect()) {
if (obj instanceof CosArray) {
obj = ((CosArray)obj).copy();
} else if (obj instanceof CosDictionary) {
obj = ((CosDictionary)obj).copy();
} else if (obj instanceof CosString) {
obj = ((CosString)obj).copy();
}
}
copy.add(obj);
}
return copy;
}
@Override
public int getType() {
return 5;
}
public int size() {
return this.mData.size();
}
public boolean isEmpty() {
return this.mData.isEmpty();
}
public Iterator<CosObject> iterator() {
return new CosArrayListIterator();
}
public ListIterator<CosObject> listIterator() {
return new CosArrayListIterator();
}
@Override
public CosContainerValuesIterator getValuesIterator() {
CosObject[] values = new CosObject[this.size()];
return new CosArrayValuesIterator(this.mData.toArray(values));
}
@Override
public Object getValue() throws PDFCosParseException, PDFIOException, PDFSecurityException {
ArrayList<Object> result = new ArrayList<Object>();
if (this.mData != null) {
for (CosObject obj : this.mData) {
result.add(obj.getValue());
}
}
result.trimToSize();
return result;
}
public boolean contains(CosObject obj) {
return this.mData.contains(obj);
}
public int findName(ASName name) throws PDFCosParseException, PDFIOException, PDFSecurityException {
int arrayInd = -1;
for (int iter = 0; iter < this.size(); ++iter) {
CosObject curElem = this.get(iter);
if (!(curElem instanceof CosName) || !((CosName)curElem).nameValue().equals(name)) continue;
arrayInd = iter;
break;
}
return arrayInd;
}
public int findString(ASString name) throws PDFCosParseException, PDFIOException, PDFSecurityException {
int arrayInd = -1;
for (int iter = 0; iter < this.size(); ++iter) {
CosObject curElem = this.get(iter);
if (!(curElem instanceof CosString) || !((CosString)curElem).stringValue().equals(name)) continue;
arrayInd = iter;
break;
}
return arrayInd;
}
@Override
void setParentObj(CosContainer parent) {
if (this.isIndirect()) {
return;
}
this.mParentObj = parent;
for (CosObject obj : this.mData) {
if (obj.isIndirect()) continue;
if (obj instanceof CosString) {
((CosString)obj).setParentObj(parent);
continue;
}
if (!(obj instanceof CosContainer)) continue;
((CosContainer)obj).setParentObj(parent);
}
}
public CosObject get(int pos) throws PDFCosParseException, PDFIOException, PDFSecurityException {
try {
CosObject result = this.mData.get(pos);
if (result instanceof CosObjectRef) {
result = this.getDocument().resolveReference((CosObjectRef)result);
}
return result;
}
catch (IOException e) {
throw new PDFIOException(e);
}
}
CosObjectRef getRef(int pos) {
CosObject result = this.mData.get(pos);
if (result instanceof CosObjectRef) {
return (CosObjectRef)result;
}
return null;
}
public int getType(int pos) {
CosObject val = this.mData.get(pos);
if (val == null) {
return 0;
}
return val.getType();
}
public ASName getName(int pos) throws PDFCosParseException, PDFIOException, PDFSecurityException {
CosObject val = this.get(pos);
return val.nameValue();
}
public boolean getBoolean(int pos) throws PDFCosParseException, PDFIOException, PDFSecurityException {
CosObject val = this.get(pos);
return val.booleanValue();
}
public double getDouble(int pos) throws PDFCosParseException, PDFIOException, PDFSecurityException {
CosObject val = this.get(pos);
return val.doubleValue();
}
public double[] getArrayDouble() throws PDFCosParseException, PDFIOException, PDFSecurityException {
double[] values = new double[this.size()];
for (int i = 0; i < this.size(); ++i) {
values[i] = this.getDouble(i);
}
return values;
}
public double[] getArrayDouble(int start, int length) throws PDFCosParseException, PDFIOException, PDFSecurityException {
double[] values = new double[length];
for (int i = 0; i < length; ++i) {
values[i] = this.getDouble(i + 1);
}
return values;
}
public long getLong(int pos) throws PDFCosParseException, PDFIOException, PDFSecurityException {
CosObject val = this.get(pos);
return val.longValue();
}
public int getInt(int pos) throws PDFCosParseException, PDFIOException, PDFSecurityException {
CosObject val = this.get(pos);
return val.intValue();
}
public long[] getArrayLong() throws PDFCosParseException, PDFIOException, PDFSecurityException {
long[] values = new long[this.size()];
for (int i = 0; i < this.size(); ++i) {
values[i] = this.getLong(i);
}
return values;
}
public int[] getArrayInt() throws PDFCosParseException, PDFIOException, PDFSecurityException {
int[] values = new int[this.size()];
for (int i = 0; i < this.size(); ++i) {
values[i] = this.getInt(i);
}
return values;
}
public byte[][] getArrayBytes() throws PDFCosParseException, PDFIOException, PDFSecurityException {
int size = this.size();
byte[][] certs = new byte[size][];
for (int i = 0; i < size; ++i) {
certs[i] = this.getString(i).getBytes();
}
return certs;
}
public ASString getString(int pos) throws PDFCosParseException, PDFIOException, PDFSecurityException {
CosObject val = this.get(pos);
return val.stringValue();
}
public ASHexString getHexString(int pos) throws PDFCosParseException, PDFIOException, PDFSecurityException {
CosObject val = this.get(pos);
return val.hexStringValue();
}
public String getText(int pos) throws PDFCosParseException, PDFIOException, PDFSecurityException {
CosObject val = this.get(pos);
return val.textValue();
}
public CosString getCosString(int pos) throws PDFCosParseException, PDFIOException, PDFSecurityException {
return (CosString)this.get(pos);
}
public CosArray getCosArray(int pos) throws PDFCosParseException, PDFIOException, PDFSecurityException {
return (CosArray)this.get(pos);
}
public CosDictionary getCosDictionary(int pos) throws PDFCosParseException, PDFIOException, PDFSecurityException {
return (CosDictionary)this.get(pos);
}
public CosStream getCosStream(int pos) throws PDFCosParseException, PDFIOException, PDFSecurityException {
return (CosStream)this.get(pos);
}
public InputByteStream getStream(int pos) throws PDFCosParseException, PDFIOException, PDFSecurityException {
CosObject val = this.get(pos);
return ((CosStream)val).getStreamDecoded();
}
public void clear() throws PDFCosParseException, PDFIOException, PDFSecurityException {
try {
if (this.mData.isEmpty()) {
return;
}
this.mData.clear();
if (this.isIndirect()) {
this.getInfo().markDirty();
} else if (this.mParentObj != null) {
this.mParentObj.getInfo().markDirty();
}
}
catch (IOException e) {
throw new PDFIOException(e);
}
}
public CosObject remove(int index) throws PDFCosParseException, PDFIOException, PDFSecurityException {
try {
CosObject removed = this.mData.remove(index);
if (removed instanceof CosObjectRef) {
removed = this.getDocument().resolveReference((CosObjectRef)removed);
}
if (this.isIndirect()) {
this.getInfo().markDirty();
} else if (this.mParentObj != null) {
this.mParentObj.getInfo().markDirty();
}
return removed;
}
catch (IOException e) {
throw new PDFIOException(e);
}
}
public boolean remove(CosObject cosObject) throws PDFCosParseException, PDFIOException, PDFSecurityException {
try {
boolean removed = false;
for (int i = 0; i < this.size(); ++i) {
CosObject element = this.get(i);
if (element instanceof CosObjectRef) {
element = this.getDocument().resolveReference((CosObjectRef)element);
}
if (cosObject != element) continue;
this.remove(i);
removed = true;
}
return removed;
}
catch (IOException e) {
throw new PDFIOException(e);
}
}
public boolean add(CosObject cosObject) throws PDFCosParseException, PDFIOException, PDFSecurityException {
try {
this.add(this.size(), cosObject, false);
}
catch (IOException e) {
throw new PDFIOException(e);
}
return true;
}
public boolean addName(ASName value) throws PDFCosParseException, PDFIOException, PDFSecurityException {
return this.add(this.getDocument().createCosName(value));
}
public boolean addBoolean(boolean value) throws PDFCosParseException, PDFIOException, PDFSecurityException {
return this.add(this.getDocument().createCosBoolean(value));
}
public boolean addDouble(double value) throws PDFCosParseException, PDFIOException, PDFSecurityException {
return this.add(this.getDocument().createCosNumeric(value));
}
public boolean addLong(long value) throws PDFCosParseException, PDFIOException, PDFSecurityException {
return this.add(this.getDocument().createCosNumeric(value));
}
public boolean addInt(int value) throws PDFCosParseException, PDFIOException, PDFSecurityException {
return this.add(this.getDocument().createCosNumeric(value));
}
public boolean addText(String value) throws PDFCosParseException, PDFIOException, PDFSecurityException {
CosString newString = this.getDocument().createCosString(value);
newString.setParentObj(this.isIndirect() ? this : this.mParentObj);
return this.add(newString);
}
public boolean addString(ASString value) throws PDFCosParseException, PDFIOException, PDFSecurityException {
CosString newString = this.getDocument().createCosString(value);
newString.setParentObj(this.isIndirect() ? this : this.mParentObj);
return this.add(newString);
}
public void add(int pos, CosObject cosObject) throws PDFCosParseException, PDFIOException, PDFSecurityException {
try {
this.add(pos, cosObject, false);
}
catch (IOException e) {
throw new PDFIOException(e);
}
}
private void add(int pos, CosObject cosObject, boolean overWrite) throws PDFCosParseException, PDFIOException, PDFSecurityException, IOException {
if (this.getDocument() != cosObject.getDocument()) {
throw new PDFCosParseException("Object and container must be in same document");
}
if (cosObject.isIndirect()) {
if (!(cosObject instanceof CosObjectRef)) {
cosObject = this.getDocument().getObjectRef(cosObject.getInfo());
}
if (overWrite) {
this.mData.set(pos, cosObject);
} else {
this.mData.add(pos, cosObject);
}
} else {
CosContainer parentObj;
CosContainer cosContainer = parentObj = this.isIndirect() ? this : this.mParentObj;
if (cosObject instanceof CosContainer) {
CosContainer oldParentObj = ((CosContainer)cosObject).getParentObj();
if (oldParentObj != null) {
cosObject = cosObject instanceof CosArray ? ((CosArray)cosObject).copy() : ((CosDictionary)cosObject).copy();
}
((CosContainer)cosObject).setParentObj(parentObj);
} else if (cosObject instanceof CosString) {
CosContainer oldParentObj = ((CosString)cosObject).getParentObj();
if (oldParentObj != null) {
cosObject = ((CosString)cosObject).copy();
}
((CosString)cosObject).setParentObj(parentObj);
}
if (overWrite) {
this.mData.set(pos, cosObject);
} else {
this.mData.add(pos, cosObject);
}
if (this.isIndirect()) {
this.getInfo().markDirty();
} else if (this.mParentObj != null) {
this.mParentObj.getInfo().markDirty();
}
}
if (this.isIndirect()) {
this.getInfo().markDirty();
} else if (this.mParentObj != null) {
this.mParentObj.getInfo().markDirty();
}
}
public void addName(int pos, ASName value) throws PDFCosParseException, PDFIOException, PDFSecurityException {
this.add(pos, this.getDocument().createCosName(value));
}
public void addBoolean(int pos, boolean value) throws PDFCosParseException, PDFIOException, PDFSecurityException {
this.add(pos, this.getDocument().createCosBoolean(value));
}
public void addDouble(int pos, double value) throws PDFCosParseException, PDFIOException, PDFSecurityException {
this.add(pos, this.getDocument().createCosNumeric(value));
}
public void addLong(int pos, long value) throws PDFCosParseException, PDFIOException, PDFSecurityException {
this.add(pos, this.getDocument().createCosNumeric(value));
}
public void addInt(int pos, int value) throws PDFCosParseException, PDFIOException, PDFSecurityException {
this.add(pos, this.getDocument().createCosNumeric(value));
}
public void addText(int pos, String value) throws PDFCosParseException, PDFIOException, PDFSecurityException {
CosString newString = this.getDocument().createCosString(value);
newString.setParentObj(this.isIndirect() ? this : this.mParentObj);
this.add(pos, newString);
}
public void addString(int pos, ASString value) throws PDFCosParseException, PDFIOException, PDFSecurityException {
CosString newString = this.getDocument().createCosString(value);
newString.setParentObj(this.isIndirect() ? this : this.mParentObj);
this.add(pos, newString);
}
public boolean set(int pos, CosObject cosObject) throws PDFCosParseException, PDFIOException, PDFSecurityException {
try {
this.add(pos, cosObject, true);
}
catch (IOException e) {
throw new PDFIOException(e);
}
return true;
}
public void extendIfNecessaryAndSet(int pos, CosObject cosObject) throws PDFCosParseException, PDFIOException, PDFSecurityException {
while (this.mData.size() <= pos) {
this.mData.add(null);
}
this.set(pos, cosObject);
}
public boolean setName(int pos, ASName value) throws PDFCosParseException, PDFIOException, PDFSecurityException {
return this.set(pos, this.getDocument().createCosName(value));
}
public boolean setName(int pos, String value) throws PDFCosParseException, PDFIOException, PDFSecurityException {
return this.set(pos, this.getDocument().createCosName(ASName.create(value)));
}
public boolean setBoolean(int pos, boolean value) throws PDFCosParseException, PDFIOException, PDFSecurityException {
return this.set(pos, this.getDocument().createCosBoolean(value));
}
public boolean setDouble(int pos, double value) throws PDFCosParseException, PDFIOException, PDFSecurityException {
return this.set(pos, this.getDocument().createCosNumeric(value));
}
public boolean setInt(int pos, int value) throws PDFCosParseException, PDFIOException, PDFSecurityException {
return this.set(pos, this.getDocument().createCosNumeric(value));
}
public boolean setLong(int pos, long value) throws PDFCosParseException, PDFIOException, PDFSecurityException {
return this.set(pos, this.getDocument().createCosNumeric(value));
}
public boolean setString(int pos, ASString value) throws PDFCosParseException, PDFIOException, PDFSecurityException {
CosString newString = this.getDocument().createCosString(value);
newString.setParentObj(this.isIndirect() ? this : this.mParentObj);
return this.set(pos, newString);
}
public boolean setText(int pos, String value) throws PDFCosParseException, PDFIOException, PDFSecurityException {
CosString newString = this.getDocument().createCosString(value);
newString.setParentObj(this.isIndirect() ? this : this.mParentObj);
return this.set(pos, newString);
}
@Override
public boolean equals(CosObject value) {
HashMap<Integer, HashSet<Integer>> alreadyComparedCosObjectPairsList = new HashMap<Integer, HashSet<Integer>>();
return this.safeEquals(value, alreadyComparedCosObjectPairsList);
}
@Override
boolean safeEquals(CosObject value, HashMap<Integer, HashSet<Integer>> alreadyComparedCosObjectPairsList) {
if (!(value instanceof CosArray) || value.getDocument() != this.getDocument()) {
return false;
}
if (value == this) {
return true;
}
if (!this.addCosObjectPair(value.getObjNum(), alreadyComparedCosObjectPairsList)) {
return true;
}
CosArray valueCosArray = (CosArray)value;
if (valueCosArray.size() != this.size()) {
return false;
}
ArrayList<Integer> compoundEntriesIndexList = new ArrayList<Integer>();
try {
int i;
CosObject valueAtIndex = null;
for (i = 0; i < valueCosArray.size(); ++i) {
valueAtIndex = this.get(i);
if (valueAtIndex instanceof CosScalar) {
if (valueAtIndex.equals(valueCosArray.get(i))) continue;
return false;
}
compoundEntriesIndexList.add(i);
}
for (i = 0; i < compoundEntriesIndexList.size(); ++i) {
if (((CosContainer)this.get((Integer)compoundEntriesIndexList.get(i))).safeEquals(valueCosArray.get((Integer)compoundEntriesIndexList.get(i)), alreadyComparedCosObjectPairsList)) continue;
return false;
}
}
catch (Exception e) {
throw new RuntimeException("problem occured while equating " + value.getObjNum() + " with " + this.getObjNum(), e);
}
return true;
}
public void setEncryptionState(boolean state) throws PDFCosParseException, PDFIOException, PDFSecurityException {
try {
Iterator<CosObject> iter = this.iterator();
while (iter.hasNext()) {
CosObject value = iter.next();
if (value.getType() == 4) {
((CosString)value).setIsEncrypted(state);
((CosString)value).setToEncrypt(state);
continue;
}
if (value.getType() == 7) {
((CosStream)value).setIsEncrypted(state);
((CosStream)value).setToEncrypt(state);
continue;
}
if (value.getType() == 6) {
((CosDictionary)value).setEncryptionState(state);
continue;
}
if (value.getType() != 5) continue;
((CosArray)value).setEncryptionState(state);
}
}
catch (IOException e) {
throw new PDFIOException(e);
}
}
public CosArray splitBefore(int pos) throws PDFCosParseException, PDFIOException, PDFSecurityException {
int i;
CosArray newArray = null;
if (this.isIndirect()) {
newArray = this.getDocument().createCosArray(1);
} else {
newArray = this.getDocument().createCosArray(0);
newArray.setParentObj(this.mParentObj);
}
int siz = this.size();
for (i = pos; i < siz; ++i) {
newArray.add(this.get(i));
}
for (i = pos; i < siz; ++i) {
this.remove(pos);
}
return newArray;
}
@Override
void writeOut(OutputByteStream outStream, boolean inString, boolean inDebugMode) throws PDFCosParseException, IOException, PDFSecurityException, PDFIOException {
outStream.write(91);
Iterator<CosObject> iter = this.mData.iterator();
boolean first = true;
while (iter.hasNext()) {
CosObject item = iter.next();
if (!first && (item.isIndirect() || item instanceof CosBoolean || item instanceof CosNumeric || item instanceof CosNull)) {
outStream.write(32);
}
item.writeOut(outStream, inString, inDebugMode);
first = false;
}
outStream.write(93);
}
public ASName[] getArrayName() throws PDFCosParseException, PDFIOException, PDFSecurityException {
ASName[] values = new ASName[this.size()];
for (int i = 0; i < this.size(); ++i) {
values[i] = this.getName(i);
}
return values;
}
/*
* This class specifies class file version 49.0 but uses Java 6 signatures. Assumed Java 6.
*/
public class CosArrayListIterator
implements ListIterator<CosObject> {
private int nextIndx;
private boolean nextCalled;
private boolean previousCalled;
CosArrayListIterator() {
this.nextCalled = false;
this.previousCalled = false;
this.nextIndx = 0;
}
@Override
public int nextIndex() {
return this.nextIndx;
}
@Override
public int previousIndex() {
return this.nextIndx - 1;
}
@Override
public void remove() {
if (!this.nextCalled && !this.previousCalled) {
throw new IllegalStateException("neither next nor previous have been called, or remove or add have been called after the last call to * next or previous.");
}
try {
if (this.nextCalled) {
CosArray.this.remove(--this.nextIndx);
} else {
CosArray.this.remove(this.nextIndx);
}
this.nextCalled = false;
this.previousCalled = false;
}
catch (PDFException e) {
IllegalArgumentException newException = new IllegalArgumentException();
newException.initCause(e);
throw newException;
}
}
@Override
public boolean hasNext() {
return this.nextIndx < CosArray.this.size();
}
@Override
public boolean hasPrevious() {
return this.nextIndx > 0;
}
@Override
public CosObject next() {
if (this.nextIndx >= CosArray.this.size()) {
throw new NoSuchElementException();
}
try {
this.nextCalled = true;
this.previousCalled = false;
return CosArray.this.get(this.nextIndx++);
}
catch (PDFException e) {
NoSuchElementException newException = new NoSuchElementException();
newException.initCause(e);
throw newException;
}
}
@Override
public CosObject previous() {
try {
this.previousCalled = true;
this.nextCalled = false;
return CosArray.this.get(--this.nextIndx);
}
catch (PDFException e) {
NoSuchElementException newException = new NoSuchElementException();
newException.initCause(e);
throw newException;
}
}
@Override
public void add(CosObject o) {
try {
CosArray.this.add(this.nextIndx++, o);
this.nextCalled = false;
this.previousCalled = false;
}
catch (PDFException e) {
IllegalArgumentException newException = new IllegalArgumentException();
newException.initCause(e);
throw newException;
}
}
@Override
public void set(CosObject o) {
if (!this.nextCalled && !this.previousCalled) {
throw new IllegalStateException("neither next nor previous have been called, or remove or add have been called after the last call to next or previous");
}
try {
if (this.nextCalled) {
CosArray.this.set(this.nextIndx - 1, o);
} else {
CosArray.this.set(this.nextIndx, o);
}
}
catch (PDFException e) {
IllegalArgumentException newException = new IllegalArgumentException();
newException.initCause(e);
throw newException;
}
}
}
}