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 10 package org.tukaani.xz; 11 12 class DeltaEncoder extends DeltaCoder implements FilterEncoder { 13 private final DeltaOptions options; 14 private final byte[] props = new byte[1]; 15 DeltaEncoder(DeltaOptions options)16 DeltaEncoder(DeltaOptions options) { 17 props[0] = (byte)(options.getDistance() - 1); 18 this.options = (DeltaOptions)options.clone(); 19 } 20 getFilterID()21 public long getFilterID() { 22 return FILTER_ID; 23 } 24 getFilterProps()25 public byte[] getFilterProps() { 26 return props; 27 } 28 supportsFlushing()29 public boolean supportsFlushing() { 30 return true; 31 } 32 getOutputStream(FinishableOutputStream out)33 public FinishableOutputStream getOutputStream(FinishableOutputStream out) { 34 return options.getOutputStream(out); 35 } 36 } 37