Debian Codegraph @

src/org/tukaani/xz/LZMA2Decoder.java

raw symbols SCIP
1 // SPDX-License-Identifier: 0BSD
2 // SPDX-FileCopyrightText: The XZ for Java authors and contributors
3 // SPDX-FileContributor: Lasse Collin <[email protected]>
4
5 package org.tukaani.xz;
6
7 import java.io.InputStream;
8
9 class LZMA2Decoder extends LZMA2Coder implements FilterDecoder {
10 private int dictSize;
11
12 LZMA2Decoder(byte[] props) throws UnsupportedOptionsException {
13 // Up to 1.5 GiB dictionary is supported. The bigger ones
14 // are too big for int.
15 if (props.length != 1 || (props[0] & 0xFF) > 37)
16 throw new UnsupportedOptionsException(
17 "Unsupported LZMA2 properties");
18
19 dictSize = 2 | (props[0] & 1);
20 dictSize <<= (props[0] >>> 1) + 11;
21 }
22
23 @Override
24 public int getMemoryUsage() {
25 return LZMA2InputStream.getMemoryUsage(dictSize);
26 }
27
28 @Override
29 public InputStream getInputStream(InputStream in, ArrayCache arrayCache) {
30 return new LZMA2InputStream(in, dictSize, null, arrayCache);
31 }
32 }