CharacterDataImpl.java
2.34 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
/*
* Decompiled with CFR 0_118.
*/
package com.adobe.xfa.dom;
import com.adobe.xfa.Node;
import com.adobe.xfa.dom.ParentNode;
import com.adobe.xfa.dom.XFANodeHolder;
import com.adobe.xfa.ut.StringUtils;
import org.w3c.dom.CharacterData;
import org.w3c.dom.DOMException;
abstract class CharacterDataImpl
extends XFANodeHolder
implements CharacterData {
private final String mData;
CharacterDataImpl(ParentNode parent, Node newNode, String data) {
super(parent, newNode);
this.mData = data;
}
@Override
public void appendData(String arg) throws DOMException {
throw new DOMException(7, "");
}
@Override
public void deleteData(int offset, int count) throws DOMException {
throw new DOMException(7, "");
}
@Override
public String getData() throws DOMException {
return this.mData;
}
@Override
public int getLength() {
return this.mData.length();
}
@Override
public void insertData(int offset, String arg) throws DOMException {
throw new DOMException(7, "");
}
@Override
public boolean isEqualNode(org.w3c.dom.Node other) {
if (!(other instanceof CharacterDataImpl)) {
return false;
}
CharacterDataImpl otherCD = (CharacterDataImpl)other;
return StringUtils.equalsWithNull(this.mData, otherCD.mData);
}
@Override
public void replaceData(int offset, int count, String arg) throws DOMException {
throw new DOMException(7, "");
}
@Override
public void setData(String arg) throws DOMException {
throw new DOMException(7, "");
}
@Override
public String substringData(int offset, int count) throws DOMException {
int currentLength = this.mData.length();
if (offset < 0 || offset >= currentLength || count < 0) {
throw new DOMException(1, "");
}
int afterIndex = offset + count;
if (afterIndex > currentLength) {
afterIndex = currentLength;
}
return this.mData.substring(offset, afterIndex);
}
@Override
public String getNodeValue() throws DOMException {
return this.mData;
}
@Override
public String getTextContent() throws DOMException {
return this.mData;
}
final String getCharacterData() {
return this.mData;
}
}