List of usage examples for org.apache.hadoop.io BytesWritable getCapacity
public int getCapacity()
From source file:com.liveramp.cascading_ext.Bytes.java
License:Apache License
public static byte[] getBytes(BytesWritable bw) { if (bw.getCapacity() == bw.getLength()) { return bw.getBytes(); } else {//from w w w.j a v a2s .c o m return copyBytes(bw); } }
From source file:voldemort.store.readonly.mr.utils.HadoopUtils.java
License:Apache License
/** * Tag the BytesWritable with an integer at the END */// w w w. j a v a 2s .co m public static void appendTag(BytesWritable writable, int tag) { int size = writable.getLength(); if (writable.getCapacity() < size + 4) { // BytesWritable preserves old values writable.setCapacity(size + 4); } ByteUtils.writeInt(writable.getBytes(), tag, size); writable.setSize(size + 4); }