org.apache.hadoop.hbase.io
Class Cell

java.lang.Object
  extended by org.apache.hadoop.hbase.io.Cell
All Implemented Interfaces:
Iterable<Map.Entry<Long,byte[]>>, org.apache.hadoop.io.Writable

public class Cell
extends Object
implements org.apache.hadoop.io.Writable, Iterable<Map.Entry<Long,byte[]>>

Cell - Used to transport a cell value (byte[]) and the timestamp it was stored with together as a result for get and getRow methods. This promotes the timestamp of a cell to a first-class value, making it easy to take note of temporal data. Cell is used all the way from HStore up to HTable.


Field Summary
protected  SortedMap<Long,byte[]> valueMap
           
 
Constructor Summary
Cell()
          For Writable compatibility
Cell(byte[][] vals, long[] ts)
           
Cell(byte[] value, long timestamp)
          Create a new Cell with a given value and timestamp.
Cell(String[] vals, long[] ts)
           
Cell(String value, long timestamp)
          Create a new Cell with a given value and timestamp.
 
Method Summary
 void add(byte[] val, long ts)
          Add a new timestamp and value to this cell
 int getNumValues()
           
 long getTimestamp()
           
 byte[] getValue()
           
 Iterator<Map.Entry<Long,byte[]>> iterator()
           
 void mergeCell(Cell c)
          Add values and timestamps of another cell into this cell
 void readFields(DataInput in)
           
 String toString()
           
 void write(DataOutput out)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

valueMap

protected final SortedMap<Long,byte[]> valueMap
Constructor Detail

Cell

public Cell()
For Writable compatibility


Cell

public Cell(String value,
            long timestamp)
Create a new Cell with a given value and timestamp. Used by HStore.

Parameters:
value -
timestamp -

Cell

public Cell(byte[] value,
            long timestamp)
Create a new Cell with a given value and timestamp. Used by HStore.

Parameters:
value -
timestamp -

Cell

public Cell(String[] vals,
            long[] ts)
Parameters:
vals - array of values
ts - array of timestamps

Cell

public Cell(byte[][] vals,
            long[] ts)
Parameters:
vals - array of values
ts - array of timestamps
Method Detail

getValue

public byte[] getValue()
Returns:
the current cell's value

getTimestamp

public long getTimestamp()
Returns:
the current cell's timestamp

getNumValues

public int getNumValues()
Returns:
the number of values this cell holds

mergeCell

public void mergeCell(Cell c)
Add values and timestamps of another cell into this cell

Parameters:
c - Cell

add

public void add(byte[] val,
                long ts)
Add a new timestamp and value to this cell

Parameters:
val - value
ts - timestamp

toString

public String toString()
Overrides:
toString in class Object

readFields

public void readFields(DataInput in)
                throws IOException
Specified by:
readFields in interface org.apache.hadoop.io.Writable
Throws:
IOException

write

public void write(DataOutput out)
           throws IOException
Specified by:
write in interface org.apache.hadoop.io.Writable
Throws:
IOException

iterator

public Iterator<Map.Entry<Long,byte[]>> iterator()
Specified by:
iterator in interface Iterable<Map.Entry<Long,byte[]>>


Copyright © 2008 The Apache Software Foundation