I have a long string sl and an array of shorter strings S = [s1, s2, ..., sn] and need to know the length of the compressed strings one gets by concatenating sl with each of the strings in S. Is there a faster way than:
Basically I wonder if there is some way to create a Libz deflate stream, compress sl and then copy/reuse that stream and then write the strings in S to it (and then measure length of output from the closed stream). I assume it is not enough to add a copy method to ZStream since one might need to copy zlib internal data also?
I have a long string sl and an array of shorter strings S = [s1, s2, ..., sn] and need to know the length of the compressed strings one gets by concatenating sl with each of the strings in S. Is there a faster way than:
?
Basically I wonder if there is some way to create a Libz deflate stream, compress sl and then copy/reuse that stream and then write the strings in S to it (and then measure length of output from the closed stream). I assume it is not enough to add a copy method to ZStream since one might need to copy zlib internal data also?
Thanks in advance for any tips/advice.