NumericEntityUnescaper.java
3.32 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
package org.apache.commons.lang3.text.translate;
import java.io.IOException;
import java.io.Writer;
import java.util.Arrays;
import java.util.EnumSet;
public class NumericEntityUnescaper
extends CharSequenceTranslator
{
private final EnumSet<OPTION> b;
public NumericEntityUnescaper(OPTION... paramVarArgs)
{
if (paramVarArgs.length > 0)
{
this.b = EnumSet.copyOf(Arrays.asList(paramVarArgs));
return;
}
this.b = EnumSet.copyOf(Arrays.asList(new OPTION[] { OPTION.semiColonRequired }));
}
public boolean isSet(OPTION paramOPTION)
{
if (this.b == null) {
return false;
}
return this.b.contains(paramOPTION);
}
public int translate(CharSequence paramCharSequence, int paramInt, Writer paramWriter)
throws IOException
{
int n = 1;
int k = paramCharSequence.length();
int i;
if ((paramCharSequence.charAt(paramInt) == '&') && (paramInt < k - 2) && (paramCharSequence.charAt(paramInt + 1) == '#'))
{
paramInt += 2;
i = paramCharSequence.charAt(paramInt);
if ((i != 120) && (i != 88)) {
break label379;
}
paramInt += 1;
if (paramInt != k) {}
}
else
{
return 0;
}
int j = 1;
label248:
label301:
label309:
label364:
label370:
label379:
for (;;)
{
i = paramInt;
while ((i < k) && (((paramCharSequence.charAt(i) >= '0') && (paramCharSequence.charAt(i) <= '9')) || ((paramCharSequence.charAt(i) >= 'a') && (paramCharSequence.charAt(i) <= 'f')) || ((paramCharSequence.charAt(i) >= 'A') && (paramCharSequence.charAt(i) <= 'F')))) {
i += 1;
}
if ((i != k) && (paramCharSequence.charAt(i) == ';')) {}
for (k = 1;; k = 0)
{
if (k != 0) {
break label248;
}
if (isSet(OPTION.semiColonRequired)) {
break;
}
if (!isSet(OPTION.errorIfNoSemiColon)) {
break label248;
}
throw new IllegalArgumentException("Semi-colon required at end of numeric entity");
}
if (j != 0) {}
try
{
int m = Integer.parseInt(paramCharSequence.subSequence(paramInt, i).toString(), 16);
if (m > 65535)
{
paramCharSequence = Character.toChars(m);
paramWriter.write(paramCharSequence[0]);
paramWriter.write(paramCharSequence[1]);
if (j == 0) {
break label364;
}
j = 1;
if (k == 0) {
break label370;
}
}
for (k = n;; k = 0)
{
return j + (i + 2 - paramInt) + k;
m = Integer.parseInt(paramCharSequence.subSequence(paramInt, i).toString(), 10);
break;
paramWriter.write(m);
break label301;
j = 0;
break label309;
}
j = 0;
}
catch (NumberFormatException paramCharSequence)
{
return 0;
}
}
}
public static enum OPTION
{
static
{
semiColonOptional = new OPTION("semiColonOptional", 1);
errorIfNoSemiColon = new OPTION("errorIfNoSemiColon", 2);
}
private OPTION() {}
}
}
/* Location: /home/merong/decompile/hackery-dex2jar.jar!/org/apache/commons/lang3/text/translate/NumericEntityUnescaper.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/