BZIP2 (.bz2) File Format - Maple Programming Help

Home : Support : Online Help : Programming : Input and Output : File Formats : Formats/BZIP2

BZIP2 (.bz2) File Format

BZIP2 file format

Description

 • BZIP2 is a format for data compression which uses the Burrows-Wheeler compression algorithm.
 • The Import command can encode and decode data in this format, and the ArrayTools[Compress] and ArrayTools[Uncompress] commands also support it.

Notes

 • Content-Type: application/zip

Examples

Read the contents of a compressed file.

 > $\mathrm{file}≔\mathrm{FileTools}:-\mathrm{JoinPath}\left(\left["example/newton.bz2"\right],\mathrm{base}=\mathrm{datadir}\right)$
 ${"C:\Program Files\Maple 2018\data\example\newton.bz2"}$ (1)
 > $\mathrm{data}≔\mathrm{Import}\left(\mathrm{file}\right)$
 ${\mathrm{data}}{≔}\left[\begin{array}{cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc}{73}& {102}& {32}& {73}& {32}& {104}& {97}& {118}& {101}& {32}& {115}& {101}& {101}& {110}& {32}& {102}& {117}& {114}& {116}& {104}& {101}& {114}& {44}& {32}& {105}& {116}& {32}& {105}& {115}& {32}& {98}& {121}& {32}& {115}& {116}& {97}& {110}& {100}& {105}& {110}& {103}& {32}& {111}& {110}& {32}& {116}& {104}& {101}& {32}& {115}& {104}& {111}& {117}& {108}& {100}& {101}& {114}& {115}& {32}& {111}& {102}& {32}& {103}& {105}& {97}& {110}& {116}& {115}& {46}& {10}\end{array}\right]$ (2)
 > $\mathrm{StringTools}:-\mathrm{FromByteArray}\left(\mathrm{data}\right)$
 ${"If I have seen further, it is by standing on the shoulders of giants."}$ (3)