Module notzed.dez
Package au.notzed.dez

Class DEZEncoder

    • Constructor Detail

      • DEZEncoder

        public DEZEncoder()
        Creates a new encoder with default parameters.

        smallest is 4 and split is @{value #OP_SINGLE_SPLIT}.

      • DEZEncoder

        public DEZEncoder​(int smallest,
                          int split)
        Creates a new encoder with a smallest copy size.

        Out of range values are silently clamped.

        Parameters:
        smallest - Sets the smallest copy allowed. It must be ≥ 4.
        split - Sets the split for a single opcode. 0 ≤ split ≤ 124;
    • Method Detail

      • getSmallest

        public int getSmallest()
      • getSplit

        public int getSplit()
      • init

        public void init​(int sourceSize,
                         int targetSize)
        Description copied from interface: ByteDeltaEncoder
        Initialises creating a new patch.

        Source is the data which will be common to both the encoder and decoder, target is only known by the encoder.

        Specified by:
        init in interface ByteDeltaEncoder
        Parameters:
        sourceSize - Size of source data.
        targetSize - Size of target data.
      • copy

        public void copy​(int addr,
                         int len)
        Description copied from interface: ByteDeltaEncoder
        Appends a copy command.
        Specified by:
        copy in interface ByteDeltaEncoder
        Parameters:
        addr - Address of data.
        len - Length of data.
      • add

        public void add​(byte[] data,
                        int off,
                        int len)
        Description copied from interface: ByteDeltaEncoder
        Appends an add command.
        Specified by:
        add in interface ByteDeltaEncoder
        Parameters:
        data - Buffer containing bytes to add.
        off - Offset of addition.
        len - Length of addition.
      • run

        public void run​(byte b,
                        int len)
        Description copied from interface: ByteDeltaEncoder
        Appends a byte-run.
        Specified by:
        run in interface ByteDeltaEncoder
        Parameters:
        b - Byte to run.
        len - Number of times to repeat byte.
      • toPatch

        public byte[] toPatch​(int targetCRC32)
        Description copied from interface: ByteDeltaEncoder
        Retrieves the patch.
        Specified by:
        toPatch in interface ByteDeltaEncoder
        Parameters:
        targetCRC32 - CRC32 of target data.
        Returns:
        The encoded patch bytes.