使用Java代码程序显示加密值的HBase密钥值

使用Java代码程序显示加密值的HBase密钥值,hbase,key-value,Hbase,Key Value,我试图用Java代码编写一个简单的HBase数据操作 代码如下 public static void main(String[] args) { Configuration hBconfig = HBaseConfiguration.create(); hBconfig.addResource(new Path("/home/circar/hbase/conf/hbase-site.xml")); try { HTable hTable = new HTa

我试图用Java代码编写一个简单的HBase数据操作

代码如下

public static void main(String[] args) {
    Configuration hBconfig = HBaseConfiguration.create();
    hBconfig.addResource(new Path("/home/circar/hbase/conf/hbase-site.xml"));
    try {
        HTable hTable = new HTable(hBconfig, "exampleHbTable");

        Result result = hTable.get(new Get(Bytes.toBytes("ExampleRow1")));

        List<KeyValue> keyValList = result.list();

        for(KeyValue keyValue : keyValList){

            System.out.println("a. Key:"+keyValue.getKeyString());
            System.out.println("a. KeyType:"+keyValue.getType());
            System.out.println("a. Row:"+keyValue.getRow().toString());
            System.out.println("a. Family:"+keyValue.getFamily().toString());
            System.out.println("a. Qualifier:"+keyValue.getQualifier().toString());
            System.out.println("a. Value:"+keyValue.getValue().toString());
            System.out.println("a. TotalColLength:"+keyValue.getTotalColumnLength());
            System.out.println("a. TimeStamp:"+keyValue.getTimestamp());

            SplitKeyValue splitKeyValue = keyValue.split();
            System.out.println("b. KeyType:"+splitKeyValue.getType());
            System.out.println("b. Row:"+splitKeyValue.getRow().toString());
            System.out.println("b. Family:"+splitKeyValue.getFamily().toString());
            System.out.println("b. Qualifier:"+splitKeyValue.getQualifier().toString());
            System.out.println("b. Value:"+splitKeyValue.getValue().toString());
            System.out.println("b. TimeStamp:"+splitKeyValue.getTimestamp());

        }

    } catch (IOException e) {
        e.printStackTrace();
    }
}
但其值如HBase外壳中所示,如下所示:

    ~-desktop:~$ sudo hbase/bin/hbase shell

    HBase Shell; enter 'help<RETURN>' for list of supported commands.
    Type "exit<RETURN>" to leave the HBase Shell
    Version 0.94.8, r1485407, Wed May 22 20:53:13 UTC 2013

    hbase(main):001:0> 
    hbase(main):002:0* list
    TABLE                                                                                                                        
    exampleHbTable                                                                                                               
    1 row(s) in 0.7540 seconds

    hbase(main):003:0> scan 'exampleHbTable'
    ROW                              COLUMN+CELL                                                                                 
     ExampleRow1                     column=CircarConsulting:MapReduce, timestamp=1371807313165, value=Hadoop                    
     ExampleRow1                     column=Projects:MapReduce, timestamp=1371807313165, value=MyProject                         
    1 row(s) in 0.1170 seconds

    hbase(main):004:0> 
~-桌面:~$sudo hbase/bin/hbase shell
HBase外壳;输入“帮助”以获取支持的命令列表。
键入“exit”以离开HBase外壳
版本0.94.8,r1485407,星期三2013年5月22日20:53:13 UTC
hbase(主):001:0>
hbase(主):002:0*列表
桌子
示例B表格
0.7540秒内1行
hbase(主):003:0>扫描“exampleHbTable”
行+列+单元格
ExampleRow1 column=CircarConsulting:MapReduce,时间戳=1371807313165,值=Hadoop
ExampleRow1 column=Projects:MapReduce,时间戳=1371807313165,值=MyProject
0.1170秒内1行
hbase(主):004:0>
有人能提供一些使用Java代码获取实际可读值的方法吗?

使用HBase API提供的Bytes.toString()将这些byte[]转换为字符串表示形式。Java的toString()在这里不起作用

Example:
System.out.println("a. Row:" + Bytes.toString(keyValue.getRow()));

不客气。如果它完全适合你,你可能会接受它作为答案,这样其他人就可以从中受益。欢迎使用SO:)您看到的值不是加密的值,而是存储在HBase中的字节数组。
Example:
System.out.println("a. Row:" + Bytes.toString(keyValue.getRow()));