XFAJSONWriter.java
1.82 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
/*
* Decompiled with CFR 0_118.
*/
package com.adobe.aemds.guide.xfa;
import com.adobe.aemds.guide.service.GuideException;
import com.adobe.aemds.guide.utils.CustomJSONWriter;
import java.io.Writer;
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Stack;
/*
* This class specifies class file version 49.0 but uses Java 6 signatures. Assumed Java 6.
*/
public class XFAJSONWriter
extends CustomJSONWriter {
public XFAJSONWriter(Writer w) {
super(w);
}
public XFAJSONWriter startObject(String key) throws GuideException {
if (key != null) {
this.key(key);
} else {
key = "null";
}
this.objectStack.push(key);
return (XFAJSONWriter)this.object();
}
public XFAJSONWriter completeObject(String key) throws GuideException {
String top;
if (key == null) {
key = "null";
}
if (!key.equals(top = (String)this.objectStack.pop())) {
throw new GuideException("ending object which was not started " + key);
}
return (XFAJSONWriter)this.endObject();
}
public XFAJSONWriter writeArray(String[] arr) throws GuideException {
for (int i = 0; i < arr.length; ++i) {
this.value(arr[i]);
}
return this;
}
public XFAJSONWriter writeProperties(Hashtable<String, Object> props) {
Enumeration<String> propEnum = props.keys();
while (propEnum.hasMoreElements()) {
String prop = propEnum.nextElement();
Object value = props.get(prop);
if (value instanceof String[]) {
((XFAJSONWriter)this.key(prop).array()).writeArray((String[])value).endArray();
continue;
}
this.key(prop).value(value);
}
return this;
}
}