All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.testifyproject.tukaani.xz.delta.DeltaEncoder Maven / Gradle / Ivy

There is a newer version: 1.0.0
Show newest version
/*
 * DeltaEncoder
 *
 * Author: Lasse Collin 
 *
 * This file has been put into the public domain.
 * You can do whatever you want with this file.
 */

package org.testifyproject.tukaani.xz.org.testifyproject.testifyprojectlta;

public class DeltaEncoder extends DeltaCoder {
    public DeltaEncoder(int distance) {
        super(distance);
    }

    public void encode(byte[] in, int in_off, int len, byte[] out) {
        for (int i = 0; i < len; ++i) {
            byte tmp = history[(distance + pos) & DISTANCE_MASK];
            history[pos-- & DISTANCE_MASK] = in[in_off + i];
            out[i] = (byte)(in[in_off + i] - tmp);
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy