@Override
    public long getValueHashCode(final ValueStoreHashAlgorithm valueStoreHashAlgorithm) {
        if (valueStoreHashAlgorithm != null
            && !Objects.equals(this.valueStoreHashAlgorithm, valueStoreHashAlgorithm)) {
            return valueStoreHashAlgorithm.hash(getValueBuffer());
        } else {
            return getValueHashCode();
        }
    }
Only call this after you have finished writing to the output stream.
stroom-pipeline/src/main/java/stroom/pipeline/refdata/store/StagingValueOutputStream.java