ArrayBasedUnicodeEscaper.java
2.65 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
package com.google.common.escape;
import com.google.common.annotations.Beta;
import com.google.common.annotations.GwtCompatible;
import com.google.common.base.Preconditions;
import java.util.Map;
import javax.annotation.Nullable;
@Beta
@GwtCompatible
public abstract class ArrayBasedUnicodeEscaper
extends UnicodeEscaper
{
private final char[][] a;
private final int b;
private final int c;
private final int d;
private final char e;
private final char f;
protected ArrayBasedUnicodeEscaper(ArrayBasedEscaperMap paramArrayBasedEscaperMap, int paramInt1, int paramInt2, @Nullable String paramString)
{
Preconditions.checkNotNull(paramArrayBasedEscaperMap);
this.a = paramArrayBasedEscaperMap.a;
this.b = this.a.length;
int j = paramInt1;
int i = paramInt2;
if (paramInt2 < paramInt1)
{
i = -1;
j = Integer.MAX_VALUE;
}
this.c = j;
this.d = i;
if (j >= 55296)
{
this.e = 65535;
this.f = '\000';
return;
}
this.e = ((char)j);
this.f = ((char)Math.min(i, 55295));
}
protected ArrayBasedUnicodeEscaper(Map<Character, String> paramMap, int paramInt1, int paramInt2, @Nullable String paramString)
{
this(ArrayBasedEscaperMap.create(paramMap), paramInt1, paramInt2, paramString);
}
public final String escape(String paramString)
{
Preconditions.checkNotNull(paramString);
int i = 0;
for (;;)
{
String str = paramString;
if (i < paramString.length())
{
int j = paramString.charAt(i);
if (((j < this.b) && (this.a[j] != null)) || (j > this.f) || (j < this.e)) {
str = escapeSlow(paramString, i);
}
}
else
{
return str;
}
i += 1;
}
}
protected final char[] escape(int paramInt)
{
if (paramInt < this.b)
{
char[] arrayOfChar = this.a[paramInt];
if (arrayOfChar != null) {
return arrayOfChar;
}
}
if ((paramInt >= this.c) && (paramInt <= this.d)) {
return null;
}
return escapeUnsafe(paramInt);
}
protected abstract char[] escapeUnsafe(int paramInt);
protected final int nextEscapeIndex(CharSequence paramCharSequence, int paramInt1, int paramInt2)
{
while (paramInt1 < paramInt2)
{
int i = paramCharSequence.charAt(paramInt1);
if (((i < this.b) && (this.a[i] != null)) || (i > this.f) || (i < this.e)) {
break;
}
paramInt1 += 1;
}
return paramInt1;
}
}
/* Location: /home/merong/decompile/hackery-dex2jar.jar!/com/google/common/escape/ArrayBasedUnicodeEscaper.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/