org.apache.hadoop.hbase.io
Class BatchOperation

java.lang.Object
  extended by org.apache.hadoop.hbase.io.BatchOperation
All Implemented Interfaces:
Writable

public class BatchOperation
extends Object
implements Writable

Batch update operation. If value is null, its a DELETE operation. If its non-null, its a PUT. This object is purposely bare-bones because many instances are created during bulk uploads. We have one class for DELETEs and PUTs rather than a class per type because it makes the serialization easier.

See Also:
BatchUpdate

Constructor Summary
BatchOperation()
          Default constructor used by Writable
BatchOperation(Text column)
          Creates a DELETE batch operation.
BatchOperation(Text column, byte[] value)
          Create a batch operation.
 
Method Summary
 Text getColumn()
           
 byte[] getValue()
           
 boolean isPut()
           
 void readFields(DataInput in)
          Deserialize the fields of this object from in.
 void write(DataOutput out)
          Serialize the fields of this object to out.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BatchOperation

public BatchOperation()
Default constructor used by Writable


BatchOperation

public BatchOperation(Text column)
Creates a DELETE batch operation.

Parameters:
column - column name

BatchOperation

public BatchOperation(Text column,
                      byte[] value)
Create a batch operation.

Parameters:
column - column name
value - column value. If non-null, this is a PUT operation.
Method Detail

getColumn

public Text getColumn()
Returns:
the column

getValue

public byte[] getValue()
Returns:
the value

isPut

public boolean isPut()
Returns:
True if this is a PUT operation (this.value is not null).

readFields

public void readFields(DataInput in)
                throws IOException
Description copied from interface: Writable
Deserialize the fields of this object from in.

For efficiency, implementations should attempt to re-use storage in the existing object where possible.

Specified by:
readFields in interface Writable
Parameters:
in - DataInput to deseriablize this object from.
Throws:
IOException

write

public void write(DataOutput out)
           throws IOException
Description copied from interface: Writable
Serialize the fields of this object to out.

Specified by:
write in interface Writable
Parameters:
out - DataOuput to serialize this object into.
Throws:
IOException


Copyright © 2006 The Apache Software Foundation