Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

HBase Put operation

By: a guest on Nov 28th, 2011  |  syntax: Java  |  size: 0.77 KB  |  views: 34  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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.  
clone this paste RAW Paste Data