Java API
主要类说明:
接口org.apache.hadoop.hbase.filestream.client.FSTableInterface常用接口说明:
| 方法 | 说明 |
|---|---|
| void put(FSPut fsPut) | 向HFS表中插入数据 |
| void put(List<FSPut> fsPuts) | 向HFS表中批量插入数据 |
| FSResult get(FSGet fsGet) | 从HFS表中读取数据 |
| FSResult[] get(List<FSGet> fsGets) | 从HFS表中读取多行数据 |
| void delete(FSDelete fsDelete) | 从HFS表中删除数据 |
| void delete(List<FSDelete> fsDeletes) | 从HFS表中删除多行数据 |
| void close() | 关闭表对象 |
org.apache.hadoop.hbase.filestream.client.FSTable是org.apache.hadoop.hbase.filestream.client.FSTableInterface接口的实现类。
org.apache.hadoop.hbase.filestream.client.FSHColumnDescriptor继承自org.apache.hadoop.hbase.HColumnDescriptor,新增如下接口:
| 方法 | 说明 |
|---|---|
| public void setFileColumn() | 设置这个列族为存储文件的列族。 |
| public void setFileThreshold(int fileThreshold) | 设置存储文件大小的阈值。 |
org.apache.hadoop.hbase.filestream.client.FSTableDescriptor继承自org.apache.hadoop.hbase.HTableDescriptor,没有新增接口,但是如果要使用JAVA接口创建HFS表来存储文件,必须使用该类。
org.apache.hadoop.hbase.filestream.client.FSPut继承自org.apache.hadoop.hbase.Put,新增如下接口:
| 方法 | 说明 |
|---|---|
| public FSPut(byte[] row) | 构造函数。通过rowkey来构造对象。 |
| public FSPut(byte[] row, long timestamp) | 构造函数。通过rowkey和时间戳来构造对象。 |
| public void addFile(String name, byte[] value) | 向HFS表中的存储文件的列族中插入一个文件,以name为列名,value为文件内容。 |
| public void addFile(String name, byte[] value, long ts) | 向HFS表中的存储文件的列族中插入一个文件,以name为列名,value为文件内容,ts为指定的时间戳。 |
| public void addFile(String name, InputStream inputStream) | 向HFS表中的存储文件的列族中插入一个文件,以name为列名,inputStream为文件的输入流对象。 输入流对象需要调用者自行关闭。 |
| public void addFile(String name, InputStream inputStream, long ts) | 向HFS表中的存储文件的列族中插入一个文件,以name为列名,inputStream为文件的输入流对象,ts为指定的时间戳。 输入流对象需要调用者自行关闭。 |
org.apache.hadoop.hbase.filestream.client.FSGet继承自org.apache.hadoop.hbase.Get,新增如下接口
| 方法 | 说明 |
|---|---|
| public FSGet(byte[] row) | 构造函数。根据rowkey构造对象。 |
| public void addFile(String fileName) | 指定需要返回的文件。 |
| public void addFiles(List<String> fileNames) | 指定需要返回的多个文件。 |
org.apache.hadoop.hbase.filestream.client.FSResult继承自org.apache.hadoop.hbase.Result,新增如下接口:
| 方法 | 说明 |
|---|---|
| public FSFile getFile(String fileName) | 从查询结果中返回指定文件名的FSFile文件对象。 |
org.apache.hadoop.hbase.filestream.client.FSFile接口:
| 方法 | 说明 |
|---|---|
| public InputStream createInputStream() | 从FSFile对象中获取文件的输入流对象。 |