Charset88591.java
2.89 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
/*
* Decompiled with CFR 0_118.
*/
package com.adobe.agl.charset;
import com.adobe.agl.charset.CharsetASCII;
import com.adobe.agl.charset.CharsetICU;
import com.adobe.agl.text.UnicodeSet;
import java.nio.BufferOverflowException;
import java.nio.BufferUnderflowException;
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
import java.nio.charset.CharsetDecoder;
import java.nio.charset.CharsetEncoder;
import java.nio.charset.CoderResult;
class Charset88591
extends CharsetASCII {
public Charset88591(String icuCanonicalName, String javaCanonicalName, String[] aliases) {
super(icuCanonicalName, javaCanonicalName, aliases);
}
public CharsetDecoder newDecoder() {
return new CharsetDecoder88591(this);
}
public CharsetEncoder newEncoder() {
return new CharsetEncoder88591(this);
}
void getUnicodeSetImpl(UnicodeSet setFillIn, int which) {
setFillIn.add(0, 255);
}
class CharsetEncoder88591
extends CharsetASCII.CharsetEncoderASCII {
public CharsetEncoder88591(CharsetICU cs) {
super(Charset88591.this, cs);
}
protected final CoderResult encodeLoopCoreOptimized(CharBuffer source, ByteBuffer target, char[] sourceArray, byte[] targetArray, int oldSource, int offset, int limit, boolean flush) {
int i;
int ch = 0;
for (i = oldSource; i < limit && ((ch = sourceArray[i]) & 65280) == 0; ++i) {
targetArray[i + offset] = (byte)ch;
}
if ((ch & 65280) != 0) {
source.position(i + 1);
target.position(i + offset);
return this.encodeMalformedOrUnmappable(source, ch, flush);
}
return null;
}
protected final CoderResult encodeLoopCoreUnoptimized(CharBuffer source, ByteBuffer target, boolean flush) throws BufferUnderflowException, BufferOverflowException {
char ch;
while (((ch = source.get()) & 65280) == 0) {
target.put((byte)ch);
}
return this.encodeMalformedOrUnmappable(source, ch, flush);
}
}
class CharsetDecoder88591
extends CharsetASCII.CharsetDecoderASCII {
public CharsetDecoder88591(CharsetICU cs) {
super(Charset88591.this, cs);
}
protected CoderResult decodeLoopCoreOptimized(ByteBuffer source, CharBuffer target, byte[] sourceArray, char[] targetArray, int oldSource, int offset, int limit) {
for (int i = oldSource; i < limit; ++i) {
targetArray[i + offset] = (char)(sourceArray[i] & 255);
}
return null;
}
protected CoderResult decodeLoopCoreUnoptimized(ByteBuffer source, CharBuffer target) throws BufferUnderflowException, BufferOverflowException {
do {
target.put((char)(source.get() & 255));
} while (true);
}
}
}