Class ExternalizableHelper.FormatAwareCompressor

  • All Implemented Interfaces:
    DeltaCompressor
    Enclosing class:
    ExternalizableHelper

    public static class ExternalizableHelper.FormatAwareCompressor
    extends Object
    implements DeltaCompressor
    A DeltaCompressor wrapper implementation that removes/replaces the serialization format byte (FMT_EXT) before/after delegating to the underlying compressor.
    • Field Detail

      • m_compressor

        protected DeltaCompressor m_compressor
        The wrapped DeltaCompressor.
    • Constructor Detail

      • FormatAwareCompressor

        public FormatAwareCompressor​(DeltaCompressor compressor)
        Construct a FormatAwareCompressor.
        Parameters:
        compressor - the underlying compressor
    • Method Detail

      • extractDelta

        public ReadBuffer extractDelta​(ReadBuffer bufOld,
                                       ReadBuffer bufNew)
        Compare an old value to a new value and generate a delta that represents the changes that must be made to the old value in order to transform it into the new value. The generated delta must be a ReadBuffer of non-zero length.

        If the old value is null, the generated delta must be a "replace", meaning that applying it to any value must produce the specified new value.

        Specified by:
        extractDelta in interface DeltaCompressor
        Parameters:
        bufOld - the old value
        bufNew - the new value; must not be null
        Returns:
        the changes that must be made to the old value in order to transform it into the new value, or null to indicate no change
      • toString

        public String toString()
        Returns a string representation of the object.
        Overrides:
        toString in class Object
        Returns:
        a string representation of the object