7 Nokia Corporation - initial contribution. |
7 Nokia Corporation - initial contribution. |
8 Contributors: |
8 Contributors: |
9 --> |
9 --> |
10 <!DOCTYPE concept |
10 <!DOCTYPE concept |
11 PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd"> |
11 PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd"> |
12 <concept id="GUID-4CC4D912-810B-4542-AFCD-58CEE8E0128C" xml:lang="en"><title>Open |
12 <concept id="GUID-4CC4D912-810B-4542-AFCD-58CEE8E0128C" xml:lang="en"><title>Open C libz Example</title><prolog><metadata><keywords/></metadata></prolog><conbody> |
13 C libz Example</title><prolog><metadata><keywords/></metadata></prolog><conbody> |
13 <p>The example demonstrates how to use the libz library to compress |
14 <p>The example demonstrates how to use the libz library to compress a file |
14 a file and decompress it. The library can compress and decompress |
15 and decompress it. The library can compress and decompress any kind of file |
15 any kind of file (txt, doc, xls, xml, mpeg, ppt, mp3 etc). </p> |
16 (txt, doc, xls, xml, mpeg, ppt, mp3 etc). </p> |
16 <section id="GUID-026FD8D6-6C4A-5958-B289-775D4AE1E756-GENID-1-12-1-14-1-1-5-1-3-1-11-1-11-1-2-2"><title>Download</title> <p>Click on the following link to download the example: <xref href="guid-6013a680-57f9-415b-8851-c4fa63356636/zips/guid-4e9f70e8-96f8-45be-90fc-00c9071cf562.zip" scope="external"> openclibz.zip</xref></p><p>Click: <xref href="guid-6013a680-57f9-415b-8851-c4fa63356636/guid-4e9f70e8-96f8-45be-90fc-00c9071cf562.html" scope="peer">browse</xref> to view the example code. </p> </section> |
17 <section id="GUID-026FD8D6-6C4A-5958-B289-775D4AE1E756-GENID-1-12-1-13-1-1-5-1-3-1-11-1-11-1-2-2"><title>Download</title> <p>Click |
17 <section id="GUID-7E7C4564-B10E-41F9-8A9D-D8A6C5E9C51C-GENID-1-12-1-14-1-1-5-1-3-1-11-1-11-1-2-3"><title>Design |
18 on the following link to download the example: <xref href="guid-6013a680-57f9-415b-8851-c4fa63356636/zips/guid-4e9f70e8-96f8-45be-90fc-00c9071cf562.zip" scope="external"> openclibz.zip</xref></p><p>Click: <xref href="guid-6013a680-57f9-415b-8851-c4fa63356636/guid-4e9f70e8-96f8-45be-90fc-00c9071cf562.html" scope="peer">browse</xref> to view the example code. </p> </section> |
18 and Implementation</title> <p>The following sections provide more |
19 <section id="GUID-7E7C4564-B10E-41F9-8A9D-D8A6C5E9C51C-GENID-1-12-1-13-1-1-5-1-3-1-11-1-11-1-2-3"><title>Design and |
19 information about the steps that the example performs. </p> <p><b>Capabilities</b> </p>Program capabilities are defined in <filepath>openclibz.mmp</filepath>: <codeph>CAPABILITY None</codeph><p><b>Implementation |
20 Implementation</title> <p>The following sections provide more information |
20 details of EXE</b> </p>This example is a console based application. |
21 about the steps that the example performs. </p> <p><b>Capabilities</b> </p>Program |
21 This application can be launched from the icon (openclibz) in installed |
22 capabilities are defined in <filepath>openclibz.mmp</filepath>: <codeph>CAPABILITY |
22 folder and also from eshell. When we launch it through icon it prompts |
23 None</codeph><p><b>Implementation details of EXE</b> </p>This example is a |
23 the user to enter the mode to process. The strategy parameter is used |
24 console based application. This application can be launched from the icon |
24 to select the compression algorithm. For compressing a file, it reads |
25 (openclibz) in installed folder and also from eshell. When we launch it through |
25 the file and then compresses it using the API of the libz library |
26 icon it prompts the user to enter the mode to process. The strategy parameter |
26 and then stores the compressed content in a (.gz) file. If you want |
27 is used to select the compression algorithm. For compressing a file, it reads |
27 to decompress, type d. For decompressing a file, it opens the compressed |
28 the file and then compresses it using the API of the libz library and then |
28 (.gz) file using libz API's and then reads the content and decompresses |
29 stores the compressed content in a (.gz) file. If you want to decompress, |
29 it . To check what happens to the content of the string after compression |
30 type d. For decompressing a file, it opens the compressed (.gz) file using |
30 then type s. Enter the string you want and see the data in compressed |
31 libz API's and then reads the content and decompresses it . To check what |
31 format . This option is to demonstrate compression of string using |
32 happens to the content of the string after compression then type s. Enter |
32 libz API's.<p>To run this application through eshell: </p><p><codeblock xml:space="preserve"> Usage : openclibz [-d] [-f] [-h] [-r] [-1 to -9] [files...] |
33 the string you want and see the data in compressed format . This option |
|
34 is to demonstrate compression of string using libz API's.<p>To run this application |
|
35 through eshell: </p><p><codeblock xml:space="preserve"> Usage : openclibz [-d] [-f] [-h] [-r] [-1 to -9] [files...] |
|
36 -d : decompress |
33 -d : decompress |
37 -f : compress with Z_FILTERED |
34 -f : compress with Z_FILTERED |
38 -h : compress with Huffman encoding |
35 -h : compress with Huffman encoding |
39 -r : compress with run-length encoding |
36 -r : compress with run-length encoding |
40 -1 to -9 : compression level |
37 -1 to -9 : compression level |
41 files : absolute path of files |
38 files : absolute path of files |
42 </codeblock></p><p><b>Some usage tips</b></p><p>Once you choose compression |
39 </codeblock></p><p><b>Some usage tips</b></p><p>Once you choose compression |
43 process, enter the file name. You should provide absolute path of the file |
40 process, enter the file name. You should provide absolute path of |
44 you want to compress. <filepath>(drive letter):\[(folder name)\]filename</filepath>. |
41 the file you want to compress. <filepath>(drive letter):\[(folder |
45 To get : on phone you have to press 1 few times. To get on phone you have |
42 name)\]filename</filepath>. To get : on phone you have to press |
46 to press 1 few times. To get on emulator is bit tricky. If you are lucky |
43 1 few times. To get on phone you have to press 1 few times. To get |
47 then pressing 1 will get it for you, otherwise change the mode. using "\ BUTTON" |
44 on emulator is bit tricky. If you are lucky then pressing 1 will get |
48 (Just above the enter button in the keyboard) and then try pressing 1. To |
45 it for you, otherwise change the mode. using "\ BUTTON" (Just above |
49 press enter on phone we are supposed to press 0 four times. </p><p><b>Cross |
46 the enter button in the keyboard) and then try pressing 1. To press |
50 platform usage</b></p><p>We can compress the file on any platform and uncompress |
47 enter on phone we are supposed to press 0 four times. </p><p><b>Cross |
51 it on any other platform. For example Unix's gzip files can be compressed |
48 platform usage</b></p><p>We can compress the file on any platform |
52 using the example application and decompressed using Unix's gunzip. Compression |
49 and uncompress it on any other platform. For example Unix's gzip |
53 can be done in a single step, if the buffers are large enough; or compression |
50 files can be compressed using the example application and decompressed |
54 can be done by repeated calls of the compression function. In the second scenario, |
51 using Unix's gunzip. Compression can be done in a single step, if |
55 application must provide more input and consume the output (providing more |
52 the buffers are large enough; or compression can be done by repeated |
56 output space) before each call. </p></section> |
53 calls of the compression function. In the second scenario, application |
57 <section id="GUID-D72E3F44-9925-456B-9B1D-FBCBAC2548DA"><b>APIs Used</b><p><codeph>compress</codeph>, <codeph>uncompress</codeph>, <codeph>gzopen</codeph>, <codeph>gzclose</codeph>, <codeph>gzread</codeph>, <codeph>gzwrite</codeph>, <codeph>gzerror</codeph> from |
54 must provide more input and consume the output (providing more output |
58 libz library</p><p> <codeph>fopen</codeph>, <codeph>fclose</codeph>, <codeph>fread</codeph>, <codeph>fwrite</codeph>, <codeph>mmap</codeph>, <codeph>munmap</codeph>, <codeph>fstat</codeph>, <codeph>unlink</codeph>, <codeph>printf</codeph>, <codeph>scanf</codeph> from |
55 space) before each call. </p></section> |
59 libc library </p></section> |
56 <section id="GUID-D72E3F44-9925-456B-9B1D-FBCBAC2548DA"><b>APIs Used</b><p><codeph>compress</codeph>, <codeph>uncompress</codeph>, <codeph>gzopen</codeph>, <codeph>gzclose</codeph>, <codeph>gzread</codeph>, <codeph>gzwrite</codeph>, <codeph>gzerror</codeph> from libz library</p><p> <codeph>fopen</codeph>, <codeph>fclose</codeph>, <codeph>fread</codeph>, <codeph>fwrite</codeph>, <codeph>mmap</codeph>, <codeph>munmap</codeph>, <codeph>fstat</codeph>, <codeph>unlink</codeph>, <codeph>printf</codeph>, <codeph>scanf</codeph> from libc library </p></section> |
60 <section id="GUID-67A72761-1D92-46D1-B1C9-7455978BDE4E-GENID-1-12-1-13-1-1-5-1-3-1-11-1-11-1-2-5"><title>Building and |
57 <section id="GUID-67A72761-1D92-46D1-B1C9-7455978BDE4E-GENID-1-12-1-14-1-1-5-1-3-1-11-1-11-1-2-5"><title>Building |
61 Using</title> <p>The <xref href="GUID-3100800B-B2F7-50EF-BD4C-3C345ECCB2A5.dita">Symbian |
58 and Using</title> <p>The Symbian build process describes how to build |
62 build process</xref> describes how to build this example application. </p> To |
59 this example application. </p> To build the example |
63 build the example application, go to the openclibz\group directory and build |
60 application, go to the openclibz\group directory and build the application. |
64 the application. The definition for the whole application can be found in |
61 The definition for the whole application can be found in the bld.inf |
65 the bld.inf file in the group subdirectory of the applications main directory. </section> |
62 file in the group subdirectory of the applications main directory. </section> |
66 </conbody></concept> |
63 </conbody></concept> |