Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site











SourceForge.net Logo

Compression

 

Using compression streams (zlib, LZ4, Zstd)

 

 

Compression.cpp

 

#include <Core/Core.h>

#include <plugin/lz4/lz4.h>

#include <plugin/zstd/zstd.h>

 

using namespace Upp;

 

CONSOLE_APP_MAIN

{

    StdLogSetup(LOG_FILE|LOG_COUT);

 

    String cpath = GetHomeDirFile("test");

    

    {

        FileOut out(cpath);

        ZCompressStream z(out);

        z.Put("Compressed by zlib");

    }

    

    {

        FileIn in(cpath);

        ZDecompressStream z(in);

        DLOG(z.GetLine());

    }

 

    {

        FileOut out(cpath);

        LZ4CompressStream z(out);

        z.Put("Compressed by LZ4");

    }

    

    {

        FileIn in(cpath);

        LZ4DecompressStream z(in);

        DLOG(z.GetLine());

    }

 

    {

        FileOut out(cpath);

        ZstdCompressStream z(out);

        z.Put("Compressed by LZ4");

    }

    

    {

        FileIn in(cpath);

        ZstdDecompressStream z(in);

        DLOG(z.GetLine());

    }

    

    FileDelete(cpath);

}

 

 

 

 

Do you want to contribute?