Rev | Line | |
---|
[13350] | 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;
|
---|
| 11 |
|
---|
| 12 | import java.io.InputStream;
|
---|
| 13 |
|
---|
| 14 | class DeltaDecoder extends DeltaCoder implements FilterDecoder {
|
---|
| 15 | private final int distance;
|
---|
| 16 |
|
---|
| 17 | DeltaDecoder(byte[] props) throws UnsupportedOptionsException {
|
---|
| 18 | if (props.length != 1)
|
---|
| 19 | throw new UnsupportedOptionsException(
|
---|
| 20 | "Unsupported Delta filter properties");
|
---|
| 21 |
|
---|
| 22 | distance = (props[0] & 0xFF) + 1;
|
---|
| 23 | }
|
---|
| 24 |
|
---|
| 25 | public int getMemoryUsage() {
|
---|
| 26 | return 1;
|
---|
| 27 | }
|
---|
| 28 |
|
---|
| 29 | public InputStream getInputStream(InputStream in, ArrayCache arrayCache) {
|
---|
| 30 | return new DeltaInputStream(in, distance);
|
---|
| 31 | }
|
---|
| 32 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.