Class PrintEncoder

  • All Implemented Interfaces:
    ByteDeltaEncoder

    public class PrintEncoder
    extends java.lang.Object
    implements ByteDeltaEncoder
    A dummy encoder for debugging purposes.
    • Constructor Summary

      Constructors 
      Constructor Description
      PrintEncoder()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void add​(byte[] data, int off, int len)
      Appends an add command.
      void copy​(int addr, int len)
      Appends a copy command.
      void init​(int sourceSize, int targetSize)
      Initialises creating a new patch.
      void run​(byte b, int len)
      Appends a byte-run.
      byte[] toPatch​(int crc)
      Retrieves the patch.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • PrintEncoder

        public PrintEncoder()
    • Method Detail

      • 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 crc)
        Description copied from interface: ByteDeltaEncoder
        Retrieves the patch.
        Specified by:
        toPatch in interface ByteDeltaEncoder
        Parameters:
        crc - CRC32 of target data.
        Returns:
        The encoded patch bytes.