byte[] properties = new byte[propertiesSize];
if (in.read(properties, 0, propertiesSize) != propertiesSize)
{
throw new IOException("input .lzma file is too short");
}
Decoder decoder = new Decoder();
if (!decoder.setDecoderProperties(properties))
{
throw new IOException("Incorrect stream properties");
}
long outSize = 0;
for (int i = 0; i < 8; i++)
{
int v = in.read();
if (v < 0)
{
throw new IOException("Can't read stream size");
}
outSize |= ((long) v) << (8 * i);
}
if (!decoder.code(in, out, outSize))
{
throw new IOException("Error in data stream");
}
out.flush();
out.close();