Hi.
I wrote a buffer compression for your library. Look attachment. Things I done:
1. Added next two functions:
function LIZCompress(const Buf; BufSize: SizeUInt; var OutBuf): SizeUInt;overload;
function LIZDecompress(const Buf; BufSize: SizeUInt; var OutBuf): SizeUInt;overload;
they do all work without buffers in the middle and of course no streams just direct memory to memory job.
2. I also added this 3 helpful functions:
function _ReadLE32(const Buf): UInt32;inline;
function _ReadLE64(const Buf): UInt64;inline;
procedure _WriteLE32(var p; v: UInt32);inline;
they just write/read to the buffer.
3. I also added
function LIZCompressMaxSize(BufSize: SizeUInt): SizeUInt;inline;
which is needed when you need to find worst possible size of compressed buffer it needed for work of _LIZ but also may be useful with LIZCompress.
4. I didn't touch original LIZ and UnLIZ, but created this functions:
function _LIZ(Uncompressed: AnsiString): AnsiString;
function _UnLIZ(Compressed: AnsiString; UncompressedSize: SizeUInt): AnsiString;
they use LIZCompress and LIZDecompress.
There is one disadvantage: _UnLIZ require to know uncompressed size of passed data.
By the way I found one issue in your project. Since you using variable written of type Integer your functions can only handle up to ~2.1 Gb of input data. In my code there is no such problem because it uses SizeUInt.
paszlib has the same problem as your library. It has no support of raw buffers.
And I have 1 question for LIZ compression. You using the smallest possible block for compression with size 128 * 1024. Is it the designed size for this algorithm or you just pick this size by yourself?