直接贴代码啦 /** * * @param zkip * @param zkport * @param tablename * @param startrow 传null扫全表 * @param stoprow 已~结尾 * @throws exception */public static void scantable(string zkip,string zkport,string tablename,string startrow,strin
        		直接贴代码啦
/**	 * 	 * @param zkip	 * @param zkport	 * @param tablename	 * @param startrow   传null扫全表	 * @param stoprow 已~结尾	 * @throws exception	 */	public static void scantable(string zkip,string zkport,string tablename,string startrow,string stoprow) throws exception {				htablepool pool;		configuration config = hbaseconfiguration.create();		config.set(hbase.zookeeper.quorum,zkip);//		config.set(hbase.zookeeper.property.clientport, zkport);		pool = new htablepool(config, 2);				htableinterface hbtable = null;		try {			hbtable = pool.gettable(tablename); // 表名			resultscanner rs = null;			scan scan = new scan();			// scan.addcolumn(bytes.tobytes(cf1),bytes.tobytes(qual1));扫某一列			if (startrow != null) { // 设置扫描的范围				scan.setstartrow(bytes.tobytes(startrow));			}			if (stoprow != null) {				scan.setstoprow(bytes.tobytes(stoprow));			}			rs = hbtable.getscanner(scan);			hbtable.close();			for (result r : rs) {// 按行去遍历				for (keyvalue kv : r.raw()) {// 遍历每一行的各列					stringbuffer sb = new stringbuffer()							.append(bytes.tostring(kv.getrow())).append(\t)							.append(bytes.tostring(kv.getfamily()))							.append(\t)							.append(bytes.tostring(kv.getqualifier()))							.append(\t).append(bytes.tostring(kv.getvalue()));					system.out.println(sb.tostring());					// kv.getrow() key					// kv.getfamily() cf1					// kv.getqualifier() 列名					// kv.getvalue() value				}			}		} catch (exception e) {			system.out.println(e.getmessage());		}finally{			pool.close();		}	      	}
   
 
   