Ejemplo n.º 1
0
  public int writeValues(byte[] output, Object[] values, int srcOffset) {
    int offset = srcOffset;
    // check if all values can be delta-ed or not
    boolean isDelta;

    if (deltaEnabled && rowDelta) {
      isDelta = isRowDelta(values);
      BitCodec.write(output, isDelta ? 1 : 0, offset++, 1);
    }

    for (int i = 0; i < writers.length; i++) {
      Writer writer = writers[i];
      Object value = values[i];
      if (deltaEnabled && !rowDelta && !writer.fixed) {
        isDelta = writer.isDelta(value);
        BitCodec.write(output, isDelta ? 1 : 0, offset++, 1);
      } else {
        isDelta = false;
      }

      offset +=
          isDelta
              ? writer.writeDelta(output, value, offset)
              : writer.writeRaw(output, value, offset);
    }
    return offset - srcOffset;
  }
Ejemplo n.º 2
0
 protected boolean isRowDelta(Object[] values) {
   for (int i = 0; i < writers.length; i++) {
     Writer writer = writers[i];
     Object value = values[i];
     if (!writer.fixed && !writer.isDelta(value)) {
       return false;
     }
   }
   return true;
 }