Updated on 2022-06-01 GMT+08:00

HFS Java APIs

Prerequisites

The cluster version is earlier than MRS 3.x.

API Description

This section describes major classes.

Common APIs of org.apache.hadoop.hbase.filestream.client.FSTableInterface:

Method

Description

void put(FSPut fsPut)

Inserts data into HFS tables.

void put(List<FSPut> fsPuts)

Inserts data into HFS tables in batches.

FSResult get(FSGet fsGet)

Reads data from HFS tables.

FSResult[] get(List<FSGet> fsGets)

Reads multiple lines of data from HFS tables.

void delete(FSDelete fsDelete)

Deletes data from HFS tables.

void delete(List<FSDelete> fsDeletes)

Deletes multiple lines of data from HFS tables.

void close()

Closes a table object.

org.apache.hadoop.hbase.filestream.client.FSTable is the implementation class of org.apache.hadoop.hbase.filestream.client.FSTableInterface.

org.apache.hadoop.hbase.filestream.client.FSHColumnDescriptor inherits from org.apache.hadoop.hbase.HColumnDescriptor. The following APIs are added:

Method

Description

public void setFileColumn()

Sets the column family of stored files to this column family.

public void setFileThreshold(int fileThreshold)

Sets the threshold for the size of stored files.

org.apache.hadoop.hbase.filestream.client.FSTableDescriptor inherits from org.apache.hadoop.hbase.HTableDescriptor without added APIs. This class is required when Java APIs are used to create HFS tables for storing files.

org.apache.hadoop.hbase.filestream.client.FSPut inherits from org.apache.hadoop.hbase.Put. The following APIs are added:

Method

Description

public FSPut(byte[] row)

Constructor. It constructs an object using Rowkeys.

public FSPut(byte[] row, long timestamp)

Constructor. It constructs an object using Rowkeys and timestamps.

public void addFile(String name, byte[] value)

Inserts a file into the column family of the stored files in the HFS table, with name as the column name and value as the file content.

public void addFile(String name, byte[] value, long ts)

Inserts a file into the column family of the stored files in the HFS table, with name as the column name, value as the file content, and ts as the specified timestamp.

public void addFile(String name, InputStream inputStream)

Inserts a file into the column family of the stored files in the HFS table, with name as the column name and inputStream as the input stream object of the file.

The input stream object needs to be closed by the invoker.

public void addFile(String name, InputStream inputStream, long ts)

Inserts a file into the column family of the stored files in the HFS table, with name as the column name, inputStream as the input stream object of the file, and ts as the specified timestamp.

The input stream object needs to be closed by the invoker.

org.apache.hadoop.hbase.filestream.client.FSGet inherits from org.apache.hadoop.hbase.Get. The following APIs are added:

Method

Description

public FSGet(byte[] row)

Constructor. It constructs an object using Rowkeys.

public void addFile(String fileName)

Specifies the file to be returned.

public void addFiles(List<String> fileNames)

Specifies the files to be returned.

org.apache.hadoop.hbase.filestream.client.FSResult inherits from org.apache.hadoop.hbase.Result. The following APIs are added:

Method

Description

public FSFile getFile(String fileName)

Returns the FSFile object whose file name is specified from the query results.

org.apache.hadoop.hbase.filestream.client.FSFile API:

Method

Description

public InputStream createInputStream()

Obtains the input stream object from the FSFile object.