Java Code Examples for org.apache.hadoop.hbase.client.Scan.getAttribute()

The following are Jave code examples for showing how to use getAttribute() of the org.apache.hadoop.hbase.client.Scan class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: ditb   File: ScanRange.java   Source Code and License Vote up 5 votes
public static ScanRangeList getScanRangeList(Scan scan) throws IOException {
  ScanRangeList rangeList = new ScanRange.ScanRangeList();
  byte[] attr = scan.getAttribute(ScanRange.SCAN_RANGE_ATTRIBUTE_STR);
  if (attr == null) {
    throw new IOException("scan should have attribute " + ScanRange.SCAN_RANGE_ATTRIBUTE_STR
        + " to convert to ScanRangeList");
  }
  ByteArrayInputStream inputStream = new ByteArrayInputStream(attr);
  DataInputStream dis = new DataInputStream(inputStream);
  rangeList.readFields(dis);
  return rangeList;
}