首 页文章中心下载中心繁體中文
设为首页
加入收藏
联系我们
您当前的位置:开源盛世-源代码下载网 -> 文章中心 -> 其他编程 -> Java技术 -> 文章内容 退出登录 用户管理
栏目导航
· VC# 技术 · Delphi技术
· Java技术 · 通用算法
· 编程相关
热门文章
· Tab Control控件使用...
· 学生档案管理系统
· [图文] 排列组合公式
· UTF-8与GB2312之间的...
· DirectShow下载安装...
· Virtual PC 在PAE模...
· Windows2000终端服务...
· MapInfo上的GIS系统...
· kalman filter 卡尔...
· Windows2000终端服务...
相关文章
· 什么时候该进行wide...
byte2unicode得函数 [转]
作者:佚名  来源:vscodes.com整理  发布时间:2005-12-16 12:58:09  发布人:Polaris

减小字体 增大字体

//author :  Allyfeng
public class AppendAPI
{

public AppendAPI()
{
}

public static String Byte2Unicode(byte abyte[], int st, int bEnd) // 不包含bEnd
{
StringBuffer sb = new StringBuffer("");
for(int j = st; j < bEnd; )
{
int lw = abyte[j++];
if (lw < 0) lw += 256;
int hi = abyte[j++];
if (hi < 0) hi += 256;
char c = (char)(lw + (hi << 8));
sb.append(c);
}

return sb.toString();
}

public static String Byte2Unicode(byte abyte[], int len)
{
return Byte2Unicode(abyte, 0, len);
}

public static String Byte2Unicode(byte abyte[])
{
return Byte2Unicode(abyte, 0, abyte.length);
}

public static byte[] Unicode2Byte(String s)
{
int len = s.length();
byte abyte[] = new byte[len << 1];
int j = 0;
for(int i = 0; i < len; i++)
{
char c = s.charAt(i);
abyte[j++] = (byte)(c & 0xff);
abyte[j++] = (byte)(c >> 8);
}

return abyte;
}
}

End of《byte2unicode得函数 [转]》

[] [返回上一页] [打 印] [收 藏]
上一篇文章:来自Moto得GB2Unicode类
 
∷相关“byte2unicode得函数 [转]”文章评论∷
(评论内容只代表网友观点,与本站立场无关!) [更多评论...]
关于本站 - 网站帮助 - 广告合作 - 下载声明 - 友情连接 - 网站地图 网站目录 鄂ICP备06007162
开源盛世 版权所有Copyright © 2003-2005 VSCodes.Com. All Rights Reserved.