@Override
  public void start(@SuppressWarnings("rawtypes") CoprocessorEnvironment env) throws IOException {
    RegionCoprocessorEnvironment renv = (RegionCoprocessorEnvironment) env;
    sourceValue = Bytes.toBytes(renv.getConfiguration().get(ORIGINAL_VALUE_KEY));
    replacedValue = Bytes.toBytes(renv.getConfiguration().get(REPLACED_VALUE_KEY));
    comparator = new Bytes.ByteArrayComparator();
    cellBuilder = CellBuilderFactory.create(CellBuilderType.SHALLOW_COPY);
  }
This RegionObserver replaces the values of Puts from one value to another on compaction.
hbase-examples/src/main/java/org/apache/hadoop/hbase/coprocessor/example/ValueRewritingObserver.java