赞
踩
ByteBuffer byteBuffer = ByteBuffer.allocate(4*1024);
byteBuffer.put("abcdefghijk".getBytes());
// System.out.println(Byte.toString(byteBuffer.get()));
// System.out.println(byteBuffer.get()+"");
// System.out.println(new String(new byte[]{byteBuffer.get()}));
被注释掉的三行代码分别单独执行,输出结果分别为:
97 (注意,是String类型)
97 (注意,是String类型)
a
所以,byte转String,一般选用new String(new byte[]{byteBuffer.get()})
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。