org.apache.hadoop.hbase.codec
Interface Encoder

All Known Implementing Classes:
BaseEncoder, KeyValueCodec.KeyValueEncoder

@InterfaceAudience.Private
@InterfaceStability.Evolving
public interface Encoder

Accepts a stream of KeyValues. This can be used to anywhere KeyValues need to be written out, but currently it is only used for serializing WALEdits. This could be backed by a List, but more efficient implementations will append results to a byte[] to eliminate overhead, and possibly encode the underlying data further.

To read the data back, use a corresponding Decoder

See Also:
Decoder

Method Summary
 void flush()
          Let the implementation decide what to do.
 void write(KeyValue cell)
          Implementation must copy the entire state of the cell.
 

Method Detail

write

void write(KeyValue cell)
           throws IOException
Implementation must copy the entire state of the cell. If the written cell is modified immediately after the write method returns, the modifications must have absolutely no effect on the copy of the cell that was added in the write.

Parameters:
cell - cell to serialize
Throws:
IOException

flush

void flush()
           throws IOException
Let the implementation decide what to do. Usually means writing accumulated data into a byte[] that can then be read from the implementation to be sent to disk, put in the block cache, or sent over the network.

Throws:
IOException


Copyright © 2015 The Apache Software Foundation. All Rights Reserved.