📄 utf8util_ao.java
字号:
// Decompiled by DJ v3.9.9.91 Copyright 2005 Atanas Neshkov Date: 2006-5-1 19:31:40
// Home Page : http://members.fortunecity.com/neshkov/dj.html - Check often for new version!
// Decompiler options: packimports(3)
public final class Utf8Util_ao
{
public Utf8Util_ao()
{
}
public static final synchronized byte[] Encode(boolean flag, String s)
{
int i;
if(s == null || (i = s.length()) <= 0)
return null;
int j = i * 3;
if(flag && j > 800)
j = 800;
byte abyte0[] = new byte[j];
int k = 0;
int l = 0;
do
{
if(l >= i)
break;
char c;
if((c = s.charAt(l)) >= 0 && c <= '\177')
{
abyte0[k] = (byte)c;
k++;
} else
if(c >= '\200' && c <= '\u07FF')
{
abyte0[k] = (byte)(c >> 6 | 0xc0);
abyte0[k + 1] = (byte)(c & 0x3f | 0x80);
k += 2;
} else
if(c >= '\u0800' && c <= '\uFFFF')
{
abyte0[k] = (byte)(c >> 12 | 0xe0);
abyte0[k + 1] = (byte)(c >> 6 & 0x3f | 0x80);
abyte0[k + 2] = (byte)(c & 0x3f | 0x80);
k += 3;
}
if(k >= j)
break;
l++;
} while(true);
byte abyte1[] = new byte[k];
System.arraycopy(abyte0, 0, abyte1, 0, k);
return abyte1;
}
public static final int GetEncodingSize(String s)
{
int i;
if(s == null || (i = s.length()) <= 0)
return 0;
int j = 0;
int k = 0;
do
{
if(k >= i)
break;
char c;
if((c = s.charAt(k)) >= 0 && c <= '\177')
j++;
else
if(c >= '\200' && c <= '\u07FF')
j += 2;
else
if(c >= '\u0800' && c <= '\uFFFF')
j += 3;
if(j >= 800)
break;
k++;
} while(true);
return j;
}
public static final synchronized String Decode(byte abyte0[], int i, int j)
{
int k;
if(abyte0 == null || (k = abyte0.length) <= 0)
return null;
if(i + j > k)
return null;
char ac[] = new char[k];
int l = 0;
int i1 = i;
do
{
if(i1 >= i + j)
break;
if((abyte0[i1] & 0x80) == 0)
{
ac[l] = (char)abyte0[i1];
l++;
i1++;
} else
if((abyte0[i1] & 0xe0) == 192)
{
ac[l] = (char)((abyte0[i1] & 0x1f) << 6 | abyte0[i1 + 1] & 0x3f);
l++;
i1 += 2;
} else
if((abyte0[i1] & 0xe0) == 224)
{
ac[l] = (char)((abyte0[i1] & 0xf) << 12 | (abyte0[i1 + 1] & 0x3f) << 6 | abyte0[i1 + 2] & 0x3f);
l++;
i1 += 3;
}
} while(true);
String s;
return s = String.valueOf(ac, 0, l);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -