Advertisement
Guest User

HBase Put operation

a guest
Nov 28th, 2011
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.77 KB | None | 0 0
  1. public void write(final DataOutput out)
  2.   throws IOException {
  3.     out.writeByte(PUT_VERSION);
  4.     Bytes.writeByteArray(out, this.row);
  5.     out.writeLong(this.timestamp);
  6.     out.writeLong(this.lockId);
  7.     out.writeBoolean(this.writeToWAL);
  8.     out.writeInt(familyMap.size());
  9.     for (Map.Entry<byte [], List<KeyValue>> entry : familyMap.entrySet()) {
  10.       Bytes.writeByteArray(out, entry.getKey());
  11.       List<KeyValue> keys = entry.getValue();
  12.       out.writeInt(keys.size());
  13.       int totalLen = 0;
  14.       for(KeyValue kv : keys) {
  15.         totalLen += kv.getLength();
  16.       }
  17.       out.writeInt(totalLen);
  18.       for(KeyValue kv : keys) {
  19.         out.writeInt(kv.getLength());
  20.         out.write(kv.getBuffer(), kv.getOffset(), kv.getLength());
  21.       }
  22.     }
  23.   }
  24.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement