Java 某些方法在更新版本的Hbase扫描类中不可用
我是hbase java api新手,需要将旧的hbase 0.94代码迁移到新版本的hbase 1.2.6。从这个意义上讲,我意识到新版本中没有Scan.write()和Scan.readFields()方法 我已经查找了旧的API,在任何不推荐的列表中都没有看到这些方法。在hbase 0.98中,这些方法不可用。我找不到合适的方法来代替它们 我的scan.write代码基本上如下所示:Java 某些方法在更新版本的Hbase扫描类中不可用,java,hbase,Java,Hbase,我是hbase java api新手,需要将旧的hbase 0.94代码迁移到新版本的hbase 1.2.6。从这个意义上讲,我意识到新版本中没有Scan.write()和Scan.readFields()方法 我已经查找了旧的API,在任何不推荐的列表中都没有看到这些方法。在hbase 0.98中,这些方法不可用。我找不到合适的方法来代替它们 我的scan.write代码基本上如下所示: Scan scan = new Scan(); scan.addFamily(somefa
Scan scan = new Scan();
scan.addFamily(somefamily);
ByteArrayOutputStream out = new ByteArrayOutputStream();
DataOutputStream dos = new DataOutputStream(out);
try
{
scan.write(dos);//this is not available
}
catch (IOException e)
{
throw new IOException();
}
return Base64.encodeBytes(out.toByteArray());
ByteArrayInputStream bis = new ByteArrayInputStream(Base64.decode(conf.get(SCAN)));
DataInputStream dis = new DataInputStream(bis);
scan = new Scan();
scan.readFields(dis)
我的scan.readfields代码如下:
Scan scan = new Scan();
scan.addFamily(somefamily);
ByteArrayOutputStream out = new ByteArrayOutputStream();
DataOutputStream dos = new DataOutputStream(out);
try
{
scan.write(dos);//this is not available
}
catch (IOException e)
{
throw new IOException();
}
return Base64.encodeBytes(out.toByteArray());
ByteArrayInputStream bis = new ByteArrayInputStream(Base64.decode(conf.get(SCAN)));
DataInputStream dis = new DataInputStream(bis);
scan = new Scan();
scan.readFields(dis)
非常感谢您的帮助。您的问题的答案已提供。此外,您需要添加hbase协议库来访问
org.apache.hadoop.hbase.protobuf.generated.ClientProtos.Scan
class.您的问题的答案是可用的。此外,您需要添加hbase协议库来访问org.apache.hadoop.hbase.protobuf.generated.ClientProtos.Scan
class