Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Top Posters

Who's Online (0)

Powered by Vanilla. Made with Bootstrap.
[Scala] text compression CLI tool
  • Deque
    Posts: 78
    Hello iExploit,

    this is the first tool I created with Scala, it
    is also the first time I am dealing with text compression. But it was a
    lot of fun.
    This tool uses the LZW algorithm to compress text files for you.

    Usage

    Run:

    For compression:

    scala lzw.jar -c <filename> [<wordsize>]

    For decompression:

    scala lzw.jar -d <filename> [<wordsize>]

    For version:

    scala lzw.jar -v

    Example:

    scala lzw.jar -c input.txt 16

    Example Output:

    Compression done. Created output file input1.lzw
    size of the input file: 1257260
    size of the compressed file: 539175
    compression ratio: 57%

    Additional information:


    A wordsize of 12 is usually good for small files, a wordsize of 16 or
    more for large files. The default wordsize used will be 14 bits.

    The wordsize for decompression must be the same as you used for compression. Otherwise it won't work.

    I made some tests that show the compression ratio for different wordsizes:

    image

    Download

    Source and jar: lzw.zip

    I would like to show the source right here, but it makes the post too long.

    Have fun
    Deque
  • Xin
    Posts: 3,251
    Nice share Deque!


    Xin