Buffer to Buffer compression/decompression

  • Praty

    Praty - 2012-07-20

    Hello Lasse,
    (Please igonre if this question has already being asked and kindly redirect me to appropirate post)

    I want to thank you for your great work !!!

    I am trying to do a buffer to buffer compression, instead doing a file to file. I have a buffer to 10000 bytes and I want it to compress it and decompress it. I know when you reach end of the file action is set to LZMA_FINISH, but in case of buffer this is not helpful, is it still ok to use lzma_code with action = LZMA_RUN and never call LZMA_FINISH?

    If you have any other suggestions, please do let me know.

    Thanks in advance,

  • Lasse Collin

    Lasse Collin - 2012-07-23

    Using LZMA_FINISH isn't needed when decompressing unless using LZMA_CONCATENATED, but with compression LZMA_FINISH is always needed.

    An alternative to lzma_easy_encoder() + lzma_code() is using lzma_easy_buffer_encode(). However, if you compress very many buffers, these functions might have worse performance than using lzma_easy_encoder() + lzma_code(), because lzma_easy_buffer_encode() and friends have to reallocate the memory for the encoder or decoder everytime the function is called.


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks