首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 其他教程 > 开源软件 >

hbase的bytes跟String 转换

2013-03-06 
hbase的bytes和String 转换ByteBuffer byteBuffer ByteBuffer.allocate(8)byteBuffer.putInt(1234)? ?

hbase的bytes和String 转换

ByteBuffer byteBuffer = ByteBuffer.allocate(8);

byteBuffer.putInt(1234);

? ? ? ? byteBuffer.putInt(5678);

? ? ? ? byte[] rowkey = byteBuffer.array();?

? ? ? ? for (byte b: rowkey){

? ? ? ? System.out.println(b);

? ? ? ? }

? ? ? ? String sb = Bytes.toStringBinary(rowkey);

? ? ? ? String s = rowkey.toString();

? ? ? ? rowkey = s.getBytes();

? ? ? ? for (byte b: rowkey){

? ? ? ? System.out.println(b);

? ? ? ? }

? ? ? ? System.out.println(sb);

? ? ? ??

? ? ? ? rowkey = "test".getBytes();

? ? ? ? System.out.println(Bytes.toString(rowkey));

? ? ? ? System.out.println(Bytes.toStringBinary(rowkey)); ??

热点排行