| 1 |
|
| 2 |
|
| 3 |
|
| 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 |
|
| 14 |
|
| 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 |
} |