ArrayTools - Maple Programming Help

Home : Support : Online Help : Programming : Low-level Manipulation : Matrices, Vectors, and Arrays : ArrayTools : ArrayTools/Uncompress

ArrayTools

 Uncompress
 uncompress a byte sequence

 Calling Sequence Uncompress(data,opts)

Parameters

 data - ByteArray or list of integers opts - (optional) equation of the form format = value

Options

 • format = one of auto, bzip2, gzip, zip, or zlib
 This option allows a compression format to be specified explicitly. Options are auto, bzip2, gzip, zip, or zlib.
 If format=auto, then Uncompress will attempt to automatically detect the compression format used and uncompress the data with the correct method. Otherwise, if format is one of bzip2, gzip, zip, or zlib, the specified compression format will be assumed. The default is auto.

Description

 • The Uncompress(data) command takes the given byte array or list of integers and attempts to uncompress it.  It returns a ByteArray.
 • If data is a list, its contents must be integers between -128 and 127.

Examples

Compress string data with StringTools[Compress] and uncompress.

 > $\mathrm{data}≔\mathrm{StringTools}:-\mathrm{Compress}\left("The quick brown fox jumps over the lazy dog"\right)$
 ${\mathrm{data}}{≔}\left[\begin{array}{ccccccccccccccccccccccccccccccccccccccccccccccccccc}{120}& {-100}& {11}& {-55}& {72}& {85}& {40}& {44}& {-51}& {76}& {-50}& {86}& {72}& {42}& {-54}& {47}& {-49}& {83}& {72}& {-53}& {-81}& {80}& {-56}& {42}& {-51}& {45}& {40}& {86}& {-56}& {47}& {75}& {45}& {82}& {40}& {1}& {74}& {-25}& {36}& {86}& {85}& {42}& {-92}& {-28}& {-89}& {51}& {0}& {0}& {107}& {-74}& {15}& {-38}\end{array}\right]$ (1)
 > $\mathrm{ArrayTools}:-\mathrm{Uncompress}\left(\mathrm{data}\right)$
 $\left[\begin{array}{cccccccccccccccccccccccccccccccccccccccccccc}{84}& {104}& {101}& {32}& {113}& {117}& {105}& {99}& {107}& {32}& {98}& {114}& {111}& {119}& {110}& {32}& {102}& {111}& {120}& {32}& {106}& {117}& {109}& {112}& {115}& {32}& {111}& {118}& {101}& {114}& {32}& {116}& {104}& {101}& {32}& {108}& {97}& {122}& {121}& {32}& {100}& {111}& {103}& {0}\end{array}\right]$ (2)

Uncompress gzipped data from a URL. Note that the Import command will uncompress and parse this data in one step.

 > $\mathrm{timeline}≔"https://www.maplesoft.com/data/examples/dif/maple-timeline.dif.gz":$
 > $\mathrm{data}≔\mathrm{URL}:-\mathrm{Get}\left(\mathrm{timeline}\right):$
 > $\mathrm{numelems}\left(\mathrm{data}\right)$
 ${268}$ (3)
 > $\mathrm{uncompressed}≔\mathrm{ArrayTools}:-\mathrm{Uncompress}\left(\mathrm{data}\right):$
 > $\mathrm{numelems}\left(\mathrm{uncompressed}\right)$
 ${268}$ (4)

Compatibility

 • The ArrayTools[Uncompress] command was introduced in Maple 2015.