source: josm/trunk/src/org/tukaani/xz/DeltaDecoder.java@ 15948

Last change on this file since 15948 was 13350, checked in by stoecker, 7 years ago

see #15816 - add XZ support

File size: 788 bytes
Line 
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
10package org.tukaani.xz;
11
12import java.io.InputStream;
13
14class 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.