UnicodeEscaper.java
4.57 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
package com.google.common.escape;
import com.google.common.annotations.Beta;
import com.google.common.annotations.GwtCompatible;
import com.google.common.base.Preconditions;
import ql;
@Beta
@GwtCompatible
public abstract class UnicodeEscaper
extends Escaper
{
private static char[] a(char[] paramArrayOfChar, int paramInt1, int paramInt2)
{
char[] arrayOfChar = new char[paramInt2];
if (paramInt1 > 0) {
System.arraycopy(paramArrayOfChar, 0, arrayOfChar, 0, paramInt1);
}
return arrayOfChar;
}
protected static int codePointAt(CharSequence paramCharSequence, int paramInt1, int paramInt2)
{
Preconditions.checkNotNull(paramCharSequence);
if (paramInt1 < paramInt2)
{
int j = paramInt1 + 1;
int i = paramCharSequence.charAt(paramInt1);
if ((i < 55296) || (i > 57343)) {
return i;
}
if (i <= 56319)
{
if (j == paramInt2) {
return -i;
}
char c = paramCharSequence.charAt(j);
if (Character.isLowSurrogate(c)) {
return Character.toCodePoint(i, c);
}
paramCharSequence = String.valueOf(String.valueOf(paramCharSequence));
throw new IllegalArgumentException(paramCharSequence.length() + 89 + "Expected low surrogate but got char '" + c + "' with value " + c + " at index " + j + " in '" + paramCharSequence + "'");
}
paramCharSequence = String.valueOf(String.valueOf(paramCharSequence));
throw new IllegalArgumentException(paramCharSequence.length() + 88 + "Unexpected low surrogate character '" + i + "' with value " + i + " at index " + (j - 1) + " in '" + paramCharSequence + "'");
}
throw new IndexOutOfBoundsException("Index exceeds specified range");
}
public String escape(String paramString)
{
Preconditions.checkNotNull(paramString);
int i = paramString.length();
int j = nextEscapeIndex(paramString, 0, i);
if (j == i) {
return paramString;
}
return escapeSlow(paramString, j);
}
public abstract char[] escape(int paramInt);
protected final String escapeSlow(String paramString, int paramInt)
{
int n = paramString.length();
Object localObject1 = ql.a();
int i = 0;
int j = 0;
int k = paramInt;
paramInt = j;
label73:
int m;
Object localObject2;
if (k < n)
{
j = codePointAt(paramString, k, n);
if (j < 0) {
throw new IllegalArgumentException("Trailing high surrogate at end of input");
}
char[] arrayOfChar = escape(j);
if (Character.isSupplementaryCodePoint(j))
{
j = 2;
m = j + k;
if (arrayOfChar == null) {
break label291;
}
int i1 = k - i;
j = paramInt + i1 + arrayOfChar.length;
localObject2 = localObject1;
if (localObject1.length < j) {
localObject2 = a((char[])localObject1, paramInt, j + (n - k) + 32);
}
j = paramInt;
if (i1 > 0)
{
paramString.getChars(i, k, (char[])localObject2, paramInt);
j = paramInt + i1;
}
paramInt = j;
if (arrayOfChar.length > 0)
{
System.arraycopy(arrayOfChar, 0, localObject2, j, arrayOfChar.length);
paramInt = j + arrayOfChar.length;
}
i = paramInt;
paramInt = m;
localObject1 = localObject2;
}
}
for (;;)
{
k = nextEscapeIndex(paramString, m, n);
j = paramInt;
paramInt = i;
i = j;
break;
j = 1;
break label73;
k = n - i;
j = paramInt;
localObject2 = localObject1;
if (k > 0)
{
j = k + paramInt;
localObject2 = localObject1;
if (localObject1.length < j) {
localObject2 = a((char[])localObject1, paramInt, j);
}
paramString.getChars(i, n, (char[])localObject2, paramInt);
}
return new String((char[])localObject2, 0, j);
label291:
j = paramInt;
paramInt = i;
i = j;
}
}
public int nextEscapeIndex(CharSequence paramCharSequence, int paramInt1, int paramInt2)
{
if (paramInt1 < paramInt2)
{
int i = codePointAt(paramCharSequence, paramInt1, paramInt2);
if ((i >= 0) && (escape(i) == null))
{
if (Character.isSupplementaryCodePoint(i)) {}
for (i = 2;; i = 1)
{
paramInt1 += i;
break;
}
}
}
return paramInt1;
}
}
/* Location: /home/merong/decompile/hackery-dex2jar.jar!/com/google/common/escape/UnicodeEscaper.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/