throw new IOException("Uncompressed LZMA buffer is too large for byte buffers");
}
ByteBuffer bbu = ByteBuffer.allocateDirect((int) lzmaSize);
LzmaDecoder dec = new LzmaDecoder();
if (!dec.setDecoderProperties(lzmaProps)) {
throw new IOException("Invalid LZMA props");
}
ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor();
executor.scheduleAtFixedRate(new ByteBufferProgress(bbc), 2, 1, TimeUnit.SECONDS);
try {
InputStream is = new ByteBufferInputStream(bbc);
OutputStream os = new ByteBufferOutputStream(bbu);
if (!dec.code(is, os, lzmaSize)) {
throw new IOException("LZMA decoding error");
}
} finally {
executor.shutdown();
}