| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
package org.tukaani.xz; |
| 6 |
|
| 7 |
import java.io.InputStream; |
| 8 |
|
| 9 |
class DeltaDecoder extends DeltaCoder implements FilterDecoder { |
| 10 |
private final int distance; |
| 11 |
|
| 12 |
DeltaDecoder(byte[] props) throws UnsupportedOptionsException { |
| 13 |
if (props.length != 1) |
| 14 |
throw new UnsupportedOptionsException( |
| 15 |
"Unsupported Delta filter properties"); |
| 16 |
|
| 17 |
distance = (props[0] & 0xFF) + 1; |
| 18 |
} |
| 19 |
|
| 20 |
@Override |
| 21 |
public int getMemoryUsage() { |
| 22 |
return 1; |
| 23 |
} |
| 24 |
|
| 25 |
@Override |
| 26 |
public InputStream getInputStream(InputStream in, ArrayCache arrayCache) { |
| 27 |
return new DeltaInputStream(in, distance); |
| 28 |
} |
| 29 |
} |