It has a function that retrieves the exact length of uncompressed data in O(1) time: size_t uncompressedLength snappy_status status = snappy_uncompressed_length ( compressed, compressedLength, & uncompressedLength ) Snappy stores size of uncompressed data in header of the compressed block. This works the same as compression above except the process is reversed.īuffer uncompressed will contain our "Hello World!" string and uncompressedLength will be 12.Īgain, we can estimate size of output buffer, but this time it's not a simple constant based on input size. You can decompress compressed buffer like this: char uncompressed size_t uncompressedLength = 1000 snappy_status status = snappy_uncompress ( compressed, compressedLength, uncompressed, & uncompressedLength ) Snappy allows you to calculate the required size of the output buffer: char uncompressed = "Hello World!" size_t length = snappy_max_compressed_length ( sizeof ( uncompressed )) char * compressed = new char //. Note that the compressed version can be slightly larger than input in extreme cases. Variable length will contain length of the compressed data. You can then compress a buffer of data like this: char compressed size_t length = 1000 snappy_status status = snappy_compress ( "Hello World!", 12, compressed, & length ) Īfter calling this function, buffer compressed will contain string "Hello World!" compressed by Snappy. Of the DLLs and associated LIBs and headers.Ĭ++ code and binaries are distributed under BSD license.Īfter downloading the library, your first step is to include the header: #include "snappy-c.h" It however means that Debug build of your project will contain slower Debug build of Snappy.Īlternatively, you can download plain 7-Zip archive Your project will therefore have no DLL dependencies and there will be no C++ runtime issues. On this pageĬ++ NuGet package contains source code that is compiled together with your project. Reason: Snappy.NET, underlying C++ library, and associated tools are no longer maintained. Information presented on this page might be out of date. Snappy for Windows is provided free of charge under permissive BSD license. There are some other ports of Snappy to Windows listed at the end of this page,īut this one aims to be the most complete, the most up to date, and the most stable one. This is a Windows port of Snappy for C++. Snappy is an order of magnitude faster for most inputs, but the resulting compressed files are anywhere from 20% to 100% bigger. For instance, compared to the fastest mode of zlib, Instead, it aims for very high speeds and reasonable compression. It does not aim for maximum compression, or compatibility with any other compression library Snappy is a compression/decompression library.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |