The xz api allows for multiple compression schemes, but the default is lzma2. In order to read directly into memory, I want to read the size, allocate that much memory, and write directly into it rather than reading into a fixed 64k buffer.
LZMA2 starts with 10 bytes of metadata, 2 bytes describing the compression with 8 bytes of length. The stream comes after that. But I would like this solution to work for xz which also supports other compression algorithms. Is there an API call that will give access to the length?
I want this to use the xz API, that is commonly available on Linux and well documented (though not this part).