1 /* 2 * DeltaDecoder 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 10 package org.tukaani.xz.delta; 11 12 public class DeltaDecoder extends DeltaCoder { DeltaDecoder(int distance)13 public DeltaDecoder(int distance) { 14 super(distance); 15 } 16 decode(byte[] buf, int off, int len)17 public void decode(byte[] buf, int off, int len) { 18 int end = off + len; 19 for (int i = off; i < end; ++i) { 20 buf[i] += history[(distance + pos) & DISTANCE_MASK]; 21 history[pos-- & DISTANCE_MASK] = buf[i]; 22 } 23 } 24 } 25