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