// Decompiled by Jad v1.5.7g. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi
import java.io.*;
import java.util.Vector;
import javax.microedition.lcdui.*;
import javax.microedition.rms.RecordStore;
import javax.microedition.rms.RecordStoreNotFoundException;
public class PkgTools
{
private static final String DBName = "QQDB";
private static final int C_Record_Num = 13;
private static final int C_BlackListStart = 3;
private static String DBStrings[] = new String[13];
public PkgTools()
{
}
public static String To2Str(int i)
{
if(i < 10)
return "0" + i;
else
return "" + i;
}
public static Image createImage(String s)
{
Image image = null;
try
{
image = Image.createImage(s);
}
catch(IOException ioexception) { }
return image;
}
public static void EmptyForm(Form form)
{
for(int i = form.size() - 1; i >= 0; i--)
form.delete(i);
}
public static void EmptyList(List list)
{
for(int i = list.size() - 1; i >= 0; i--)
list.delete(i);
}
public static String Encodecgi(String s)
{//编码函数:将字符串中的' '、'&'、','、'\r'、'\t'、'\n'、'%'、'='
//这些字符转换成形如%XX的形式,其中XX为上述字符的ASCII码的十六进制形式;
StringBuffer stringbuffer = new StringBuffer();
if(s == null)
return "";
char ac[] = s.toCharArray();
int i = ac.length;
if(i == 0)
return "";
for(int j = 0; j < i; j++)
if(ac[j] == ' ' || ac[j] == '&' || ac[j] == ',' || ac[j] == '\r' || ac[j] == '\t' || ac[j] == '\n' || ac[j] == '%' || ac[j] == '=')
{
String s1 = Integer.toHexString(ac[j]);
if(s1.length() == 1)
stringbuffer.append("%0" + s1);
else
stringbuffer.append("%" + s1);
} else
{
stringbuffer.append(ac[j]);
}
return stringbuffer.toString();
}
public static String Decodecgi(String s)
{//解码函数,将含有形如%XX的十六进制数据的字符串中的%XX转换成一个字符;
//返回转换后的字符串;
StringBuffer stringbuffer = new StringBuffer();
if(s == null)
return "";
char ac[] = s.toCharArray();
int j = ac.length;
if(j == 0)
return "";
for(int i = 0; i < j;)
if(ac[i] == '%')
{
String s1 = String.valueOf(ac, i + 1, 2);
char c;
try
{
c = (char)Integer.parseInt(s1, 16);
}
catch(Exception exception)
{
c = ' ';
}
stringbuffer.append(c);
i += 3;
} else
{
stringbuffer.append(ac[i]);
i++;
}
return stringbuffer.toString();
}
public static String GetParaVal(String s, String s1)
{
String s2 = null;
int i = 0;
int j = 0;
int k = 0;
int l = 0;
if(s == null || s1 == null)
return "";
s = s + "=";
k = s.length();
l = s1.length();
if(l == 0)
return "";
if(k == 0 || k > 9)
return "";
i = s1.indexOf(s);
if(i == -1)
return "";
j = s1.indexOf(38, i);
if(j == -1)
s2 = s1.substring(i + k);
else
s2 = s1.substring(i + k, j);
return s2;
}
public static int GetMultiPara(String as[], String s)
{
int i = 0;
String s1 = null;
int j = 0;
int k = 0;
boolean flag = false;
if(as == null || s == null)
return -1;
j = s.length();
if(j >= 2560)
return -1;
i = s.indexOf(44);
if(i == -1)
{
as[0] = s;
return 1;
}
as[0] = s.substring(0, i);
if(++k == as.length)
return k;
for(s1 = s.substring(i + 1); (i = s1.indexOf(44)) != -1; s1 = s1.substring(i + 1))
{
as[k] = s1.substring(0, i);
if(++k == as.length)
return k;
}
as[k] = s1;
return ++k;
}
public static byte[] Unicode2Byte(String s)
{
int i = s.length();
byte abyte0[] = new byte[i << 1];
int j = 0;
for(int k = 0; k < i; k++)
{
char c = s.charAt(k);
abyte0[j++] = (byte)(c & 0xff);
abyte0[j++] = (byte)(c >> 8);
}
return abyte0;
}
public static byte[] convertUnicode2UTF8Byte(String s)
{
int i = s.length();
byte abyte0[] = new byte[i << 2];
int j = 0;
for(int k = 0; k < i; k++)
{
char c = s.charAt(k);
if(c < '\200')
abyte0[j++] = (byte)c;
else
if(c < '\u0800')
{
abyte0[j++] = (byte)(c >> 6 & 0x1f | 0xc0);
abyte0[j++] = (byte)(c & 0x3f | 0x80);
} else
if(c < '\0')
{
abyte0[j++] = (byte)(c >> 12 & 0xf | 0xe0);
abyte0[j++] = (byte)(c >> 6 & 0x3f | 0x80);
abyte0[j++] = (byte)(c & 0x3f | 0x80);
} else
if(c < '\0')
{
abyte0[j++] = (byte)(c >> 18 & 0x7 | 0xf0);
abyte0[j++] = (byte)(c >> 12 & 0x3f | 0x80);
abyte0[j++] = (byte)(c >> 6 & 0x3f | 0x80);
abyte0[j++] = (byte)(c & 0x3f | 0x80);
}
}
byte abyte1[] = new byte[j];
for(int l = 0; l < j; l++)
abyte1[l] = abyte0[l];
return abyte1;
}
public static void saveDB()
{
label0:
{
RecordStore recordstore = null;
ByteArrayOutputStream bytearrayoutputstream = new ByteArrayOutputStream();
DataOutputStream dataoutputstream = new DataOutputStream(bytearrayoutputstream);
Object obj = null;
try
{
recordstore = RecordStore.openRecordStore("QQDB", true);
int i = recordstore.getNumRecords();
for(int j = 0; j < 13; j++)
dataoutputstream.writeUTF(DBStrings[j]);
byte abyte0[] = bytearrayoutputstream.toByteArray();
if(i == 0)
recordstore.addRecord(abyte0, 0, abyte0.length);
else
recordstore.setRecord(1, abyte0, 0, abyte0.length);
}
catch(Exception exception2)
{
try
{
dataoutputstream.close();
}
catch(Exception exception3) { }
if(recordstore != null)
try
{
recordstore.closeRecordStore();
}
catch(Exception exception4) { }
break label0;
}
finally
{
try
{
dataoutputstream.close();
}
catch(Exception exception6) { }
if(recordstore != null)
try
{
recordstore.closeRecordStore();
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
J2ME-IM源码.rar (70个子文件)
qq
.project 534B
HttpPosterListener.java 361B
KQQMIDlet.java 13KB
FullScreen.class 674B
FullScreen.java 466B
MainMenu.class 9KB
MainForm.class 4KB
AddFriend.java 7KB
HttpPoster.class 7KB
.settings
org.eclipse.jdt.core.prefs 208B
FriendRecord.class 8KB
BlackList.class 5KB
SendMsgDlg.class 4KB
Icons.java 5KB
GetMsgDlg.class 9KB
HttpPosterListener.class 197B
FriendList.java 16KB
deployed
MultiLan.java 12KB
SendMsgDlg.java 3KB
Finger.java 11KB
KQQMIDlet.class 11KB
.eclipseme.tmp
emulation
qq.jad 207B
qq.jar 72KB
verified
libs
classes
FullScreen.class 674B
MainMenu.class 10KB
MainForm.class 5KB
HttpPoster.class 7KB
FriendRecord.class 10KB
BlackList.class 5KB
SendMsgDlg.class 4KB
GetMsgDlg.class 10KB
HttpPosterListener.class 197B
KQQMIDlet.class 12KB
Local.class 7KB
FriendList.class 12KB
AddFriend.class 6KB
AckSvrMsg.class 6KB
PkgTools.class 14KB
MultiLan.class 8KB
HistoryMsg.class 4KB
Finger.class 9KB
Icons.class 4KB
MD5.class 8KB
FriendRecordItem.class 829B
AckSvrMsg.java 6KB
Local.class 7KB
FriendList.class 11KB
FriendRecordItem.java 786B
AddFriend.class 6KB
MD5.java 10KB
Local.java 9KB
HttpPoster.java 15KB
AckSvrMsg.class 5KB
.eclipseme 230B
PkgTools.java 19KB
PkgTools.class 10KB
.classpath 244B
FriendRecord.java 12KB
MultiLan.class 8KB
BlackList.java 5KB
MainMenu.java 11KB
HistoryMsg.class 4KB
qq.jad 183B
Finger.class 8KB
HistoryMsg.java 4KB
Icons.class 4KB
GetMsgDlg.java 12KB
MainForm.java 6KB
MD5.class 8KB
FriendRecordItem.class 761B
共 70 条
- 1
资源评论
- oyxianwang2012-11-12界面很丑,对初学着有益!
- doney_dongxiang2013-06-24很有参考价值
冠宏
- 粉丝: 1
- 资源: 5
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功