Class: SerializedCellsWriter

hypertable. SerializedCellsWriter

Encodes cells into a serialized cells buffer.

Constructor

new SerializedCellsWriter(size, growopt)

Used for encoding cells into a serialized cells buffer.
Parameters:
Name Type Attributes Default Description
size Number Size of serialized cells buffer to generate
grow Boolean <optional>
false Grow buffer to accomodate added cells
Source:
Example
var writer = new hypertable.SerializedCellsWriter(1024);
var ts = new Timestamp( new Date(2015, 3, 15, 16, 15, 30) );
writer.add('row1', 'column1', 'qaulifier1', ts, 'value1');
writer.add('row2', 'column2', 'qaulifier2', ts, 'value2');
writer.add('row3', 'column3', 'qaulifier3', ts, 'value3');
...

Members

buffer :Buffer

Serialized cells buffer.
Type:
  • Buffer
Source:

offset :Number

Current encode offset within buffer.
Type:
  • Number
Source:

Methods

add(cell|row, column_familyopt, column_qualifieropt, timestampopt, valueopt, cell_flagopt)

Adds a cell to the serialized cells buffer. This method can be called with either a single Cell argument, or all of the cell components, for example:
writer.add(cell);
writer.add(row, column_family, column_qualifier, timestamp, value, cell_flag);
Parameters:
Name Type Attributes Default Description
cell|row Cell | String Cell or row key
column_family String <optional>
Column family
column_qualifier String <optional>
Column qualifier
timestamp Timestamp | Int64 <optional>
Timetamp
value Buffer <optional>
Value
cell_flag Number <optional>
255 Cell flag
Source:

clear()

Clears serialized cells buffer. This method sets the object to uninitialized state, setting offset to 0, but keeping the underlying buffer.
Source:

empty()

Checks if serialized cells buffer is empty (offset is 0)
Source:
Returns:
true if buffer is empty, false otherwise.

getBuffer()

Gets serialized cells buffer. Finalizes the buffer and returns it sliced to the exact length.
Source:
Returns:
Serialized cells buffer