截取自hbase p173
Example 3.9. Example application retrieving data from HBase
Configuration conf = HBaseConfiguration.create(); Create the configuration.
HTable table = new HTable(conf, "testtable"); Instantiate a new table reference.
Get get = new Get(Bytes.toBytes("row1"));//Create get with specific row.
get.addColumn(Bytes.toBytes("colfam1"),Bytes.toBytes("qual1"));//Add a column to the get.
Result result = table.get(get);
byte[] val = result.getValue(Bytes.toBytes("colfam1"),//Retrieve row with selected columns from HBase.
Bytes.toBytes("qual1"));//Get a specific value for the given column.
System.out.println("Value: " + Bytes.toString(val));//Print out the value while converting it back.
Print out the value while converting it back.