发布时间:2022年04月15日 05:41:23分享人:深海夜未眠来源:互联网18
Java代码- publicstaticStringbyteToString(byte[]b)
- {
- StringBufferstringBuffer=newStringBuffer();
- for(inti=0;i<b.length;i++)
- {
- stringBuffer.append((char)b[i]);
- }
- returnstringBuffer.toString();
- }
- publicstaticIoBufferstringToIoBuffer(Stringstr)
- {
- bytebt[]=str.getBytes();
- IoBufferioBuffer=IoBuffer.allocate(bt.length);
- ioBuffer.put(bt,0,bt.length);
- ioBuffer.flip();
- returnioBuffer;
- }
- publicstaticIoBufferbyteToIoBuffer(byte[]bt,intlength)
- {
- IoBufferioBuffer=IoBuffer.allocate(length);
- ioBuffer.put(bt,0,length);
- ioBuffer.flip();
- returnioBuffer;
- }
- publicstaticbyte[]ioBufferToByte(Objectmessage)
- {
- if(!(messageinstanceofIoBuffer))
- {
- returnnull;
- }
- IoBufferioBuffer=(IoBuffer)message;
- byte[]b=newbyte[ioBuffer.limit()];
- ioBuffer.get(b);
- returnb;
- }
- publicstaticStringioBufferToString(Objectmessage)
- {
- if(!(messageinstanceofIoBuffer))
- {
- return"";
- }
- IoBufferioBuffer=(IoBuffer)message;
- byte[]b=newbyte[ioBuffer.limit()];
- ioBuffer.get(b);
- StringBufferstringBuffer=newStringBuffer();
- for(inti=0;i<b.length;i++)
- {
- stringBuffer.append((char)b[i]);
- }
- returnstringBuffer.toString();
- }
![MINA中IoBuffer、byte[]、String之间转换 mina iobuffer](http://img.aihuau.com/images/01111101/01081651t0171354d1447b7cb9c.png)
爱华网本文地址 » http://www.413yy.cn/a/25101016/295482.html
更多阅读
![](http://img.aihuau.com/images/30101030/30062436t015144487a49b743c0.gif)
高中物理教学中对《布鲁姆教育目标分类学》中事实、概念、程序性知识的一点理解及归纳席源在布鲁姆教育目标分类学中,将教育目标设计为一个二维表。第一个维度将知识分为四个方面:事实性知识、概念性知识、程序性知识、元认知知识;
如何在Word中插入、修改、删除艺术字——简介艺术字在Word中的应用极为广泛,它是一种具有特殊效果的文字,比一般的文字更具艺术性,因此,在编辑排版文章的时候,往往需要使用到艺术字来实现某种特殊效果,很受广大OFFICE使用者的青睐,在此本人
![](http://img.aihuau.com/images/31101031/31012629t019eaeddd17a7b477c.jpg)
以下是EMS、申通、圆通、中通、韵达几个常用快递公司的网点分布情况,敬请各位代理悉知!邮政EMS服务范围中国境内都送申通快递网点服务范围江苏省宝应 :县城、安宜工业园、城南工业园、经济开发区、黄浦、黄塍、范水镇、小官庄镇、望直
![](http://img.aihuau.com/images/31101031/31060831t01dfd69533ea24f8e3.jpg)
节拍、节拍之间的区别节拍就是标记拍子的记号,他通常跟在调号的后面,我们常用的节拍有以下几种,2/4、3/4、4/4、3/8、6/8。分子表明一个小节内的单位拍的数目,分母表示单位拍的音符时值。比如:2/4拍子,就是以四分音符为一拍,每小节有两拍
![](http://player.56.com/v_44907418.swf)
[转] 蒋中正、蒋经国、宋美龄的原声讲话(视频)2013-4-9 12:26阅读(1)转载自老知青多