source: josm/trunk/src/org/tukaani/xz/delta/DeltaEncoder.java@ 13632

Last change on this file since 13632 was 13350, checked in by stoecker, 7 years ago

see #15816 - add XZ support

File size: 634 bytes
Line 
1/*
2 * DeltaEncoder
3 *
4 * Author: Lasse Collin <lasse.collin@tukaani.org>
5 *
6 * This file has been put into the public domain.
7 * You can do whatever you want with this file.
8 */
9
10package org.tukaani.xz.delta;
11
12public class DeltaEncoder extends DeltaCoder {
13 public DeltaEncoder(int distance) {
14 super(distance);
15 }
16
17 public void encode(byte[] in, int in_off, int len, byte[] out) {
18 for (int i = 0; i < len; ++i) {
19 byte tmp = history[(distance + pos) & DISTANCE_MASK];
20 history[pos-- & DISTANCE_MASK] = in[in_off + i];
21 out[i] = (byte)(in[in_off + i] - tmp);
22 }
23 }
24}
Note: See TracBrowser for help on using the repository browser.