File: bzip2.xml

package info (click to toggle)
phpdoc 20020310-1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 35,272 kB
  • ctags: 354
  • sloc: xml: 799,767; php: 1,395; cpp: 500; makefile: 200; sh: 140; awk: 51
file content (457 lines) | stat: -rw-r--r-- 13,807 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- EN-Revision: 1.16 Maintainer: cucinato  Status: ready -->
 <reference id="ref.bzip2">
  <title>Funzioni di compressione Bzip2</title>
  <titleabbrev>Bzip2</titleabbrev>
  <partintro>
   <para>
    Questo modulo utilizza le funzioni della libreria <ulink
    url="&url.bzip2;">bzip2</ulink> di Julian Seward per
    leggere e scrivere in modo trasparente i file compressi con bzip2 (.bz2).
   </para>
   <para>
    Il spporto di Bzip2 in PHP non &egrave; attivo per default. Si deve
    usare l'opzione di configurazione <link linkend="install.configure.with-bz2">--with-bz2</link>
    quando si compila PHP per sbilitare il supporto bzip2. Questo modulo
    richiede bzip2/libbzip2 con versione &gt;= 1.0.x.
   </para>

   <sect1 id="bzip2-example">
    <title>Breve sorgente di esempio</title>
    <para>
     Questo esempio apre un file temporaneo e scrive una stringa di prova su
     di esso, quindi stampa il contenuto del file.
    </para>
    <example>
     <title>breve esempio di bzip2</title>
     <programlisting role="php">
<![CDATA[
<?php

$nomefile = "/tmp/filediprova.bz2";
$str = "Questa  una stringa di prova.\n";

// apre il file in lettura
$bz = bzopen($nomefile, "w");

// scrive la stringa sul file
bzwrite($bz, $str);

// chiude il file
bzclose($bz);

// apre il file in lettura
$bz = bzopen($nomefile, "r");

// legge 10 caratteri
print bzread($bz, 10);

// stampa fino alla fine del file (o fino ai prossimi 1024 caratteri) e chiude il file.
print bzread($bz);

bzclose($bz);

?>
]]>
     </programlisting>
    </example>
   </sect1>
  </partintro>


  <refentry id="function.bzclose">
   <refnamediv>
    <refname>bzclose</refname>
    <refpurpose>Chiude un puntatore a un file bzip2</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Descrizione</title>
     <methodsynopsis>
      <type>int</type><methodname>bzclose</methodname>
      <methodparam><type>int</type><parameter>bz</parameter></methodparam>
     </methodsynopsis>
    <para>
     Chiude il file bzip2 referenziato dal puntatore <parameter>bz</parameter>.
    </para>
    <para>
     Restituisce &true; in caso di successo, &false; altrimenti.
    </para>
    <para>
     Il puntatore al file deve essere valido, e deve puntare a un file
     gi$agrave; aperto con <function>bzopen</function>.
    </para>
    <para>
     Vedere anche <function>bzopen</function>.
    </para>
   </refsect1>
  </refentry>

  
  <refentry id="function.bzcompress">
   <refnamediv>
    <refname>bzcompress</refname>
    <refpurpose>Comprime una stringa nel formato bzip2</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Descrizione</title>
     <methodsynopsis>
      <type>string</type><methodname>bzcompress</methodname>
      <methodparam><type>string</type><parameter>sorgente</parameter></methodparam>
      <methodparam choice="opt"><type>int</type><parameter>dimblocco</parameter></methodparam>
      <methodparam choice="opt"><type>int</type><parameter>workfactor</parameter></methodparam>
     </methodsynopsis>
    <para>
     <function>bzcompress</function> comprime la 
     stringa <parameter>sorgente</parameter> e la restituisce come dati
     codificati in bzip2.
    </para>
    <para>
     Il parametro opzionale <parameter>dimblocco</parameter> specifica
     la dimensione del blocco usato durante la compressione e dovrebbe essere un numero tra
     1 e 9 dove 9 d&agrave; la compressione migliore, ma usando pi&ugrave;
     risorse. <parameter>dimblocco</parameter> ha come valore predefinito
     4.
    </para>
    <para>
     Il parametro opzionale <parameter>workfactor</parameter> controlla
     il comportamento della fase di compressione quando deve trattare col caso peggiore,
     ovvero dati in ingresso molto ripetitivi. Il valore pu&ograve; variare tra 0 e
     250, dove 0 &egrave; un caso speciale e 30 egrave; il valore di
     default. Indipendentemente dal parametro <parameter>workfactor</parameter>, i
     dat generati sono gli stessi.
    </para>
    <para>
     <example>
      <title>Esempio di <function>bzcompress</function></title>
      <programlisting role="php">
<![CDATA[
<?php
$str = "dati di prova";
$bzstr = bzcompress($str, 9);
print( $bzstr );
?>
]]>
      </programlisting>
     </example>
    </para>
    <para>
     See also <function>bzdecompress</function>.
    </para>
   </refsect1>
  </refentry>


  <refentry id="function.bzdecompress">
   <refnamediv>
    <refname>bzdecompress</refname>
    <refpurpose>Decomprime dati codificati con bzip2</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Descrizione</title>
     <methodsynopsis>
      <type>string</type><methodname>bzdecompress</methodname>
      <methodparam><type>string</type><parameter>sorgente</parameter></methodparam>
      <methodparam choice="opt"><type>int</type><parameter>small</parameter></methodparam>
     </methodsynopsis>
    <para>
     <function>bzdecompress</function> decomprime la
     strina <parameter>sorgente</parameter> contenente dati codificati in bzip2
     e li restituisce.  Se il parametro opzionale
     <parameter>small</parameter> &egrave; &true;, verr&agrave; usato un
     algoritmo di decompressione alternativo che richiede meno memoria (la
     maximum quantit&agrave; massima di meoria richiesta scende a 2300K) ma funziona a
     circa la met&agrave; della velocit&agrave;.  Vedere la <ulink url="&url.bzip2;">documentazione di
     bzip2</ulink> per maggiori informazioni su questa funzionalit&agrave;.
    </para>
    <para>
     <example>
      <title><function>bzdecompress</function></title>
      <programlisting role="php">
<![CDATA[
<?php
$stringa_iniziale = "Sto facendo il mio lavoro?";
$bzstr = bzcompress($start_str);

print( "Stirnga Compressa: " );
print( $bzstr );
print( "\n<br>n" );

$stringa = bzdecompress($bzstr);
print( "Stringa Decompressa: " );
print( $str );
print( "\n<br>n" );
?>
]]>
      </programlisting>
     </example>
    </para>
    <para>
     See also <function>bzcompress</function>.
    </para>
   </refsect1>
  </refentry>


  <refentry id="function.bzerrno">
   <refnamediv>
    <refname>bzerrno</refname>
    <refpurpose>Restituisce il codice d'errore bzip2</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Descrizione</title>
     <methodsynopsis>
      <type>int</type><methodname>bzerrno</methodname>
      <methodparam><type>int</type><parameter>bz</parameter></methodparam>
     </methodsynopsis>
    <para>
     Restituisce il codice di un qualsiasi errore bzip2 restituito dal 
     puntatore al file <parameter>bz</parameter>.
    </para>
    <para>
     Vedere anche <function>bzerror</function> e <function>bzerrstr</function>.
    </para>
   </refsect1>
  </refentry>


  <refentry id="function.bzerror">
   <refnamediv>
    <refname>bzerror</refname>
    <refpurpose>Restituisce il codice d'errore bzip2 e la stringa corrispondente in un array</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Descrizione</title>
     <methodsynopsis>
      <type>array</type><methodname>bzerror</methodname>
      <methodparam><type>int</type><parameter>bz</parameter></methodparam>
     </methodsynopsis>
    <para>
     Restituisce il codice e la stringa di errore, sotto forma di array associativo,
     di un errore bzip2 restituito dal puntatore 
     <parameter>bz</parameter>.
    </para>
    <para>
     <example>
      <title>Esempio di <function>bzerror</function></title>
      <programlisting role="php">
<![CDATA[
<?php
$errore = bzerror($bz);

echo $errore["errno"];
echo $errore["errstr"];
?>
]]>
      </programlisting>
     </example>
    </para>
    <para>
     Vedere anche <function>bzerrno</function> e <function>bzerrstr</function>.
    </para>
   </refsect1>
  </refentry>


  <refentry id="function.bzerrstr">
   <refnamediv>
    <refname>bzerrstr</refname>
    <refpurpose>restituisce la stringa di errore bzip2</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Descrizione</title>
     <methodsynopsis>
      <type>string</type><methodname>bzerrstr</methodname>
      <methodparam><type>int</type><parameter>bz</parameter></methodparam>
     </methodsynopsis>
    <para>
     Resituisce la stringa di errore bzip2 restituito dal
     puntatore <parameter>bz</parameter>.
    </para>
    <para>
     Vedere anche <function>bzerrno</function> e <function>bzerror</function>.
    </para>
   </refsect1>
  </refentry>


  <refentry id="function.bzflush">
   <refnamediv>
    <refname>bzflush</refname>
    <refpurpose>Forza la scrittura di tutti i dati nel buffer</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Descrizione</title>
     <methodsynopsis>
      <type>int</type><methodname>bzflush</methodname>
      <methodparam><type>int</type><parameter>bz</parameter></methodparam>
     </methodsynopsis>
    <para>
     Forza la scrittura di tutti i dati che sono nel buffer del puntatore
     <parameter>bz</parameter>.
    </para>
    <para>
    &return.success; 
    </para>
    <para>
     Vedere anche <function>bzread</function> e <function>bzwrite</function>.
    </para>
   </refsect1>
  </refentry>


  <refentry id="function.bzopen">
   <refnamediv>
    <refname>bzopen</refname>
    <refpurpose>Apre un file compresso bzip2</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Descrizione</title>
     <methodsynopsis>
      <type>int</type><methodname>bzopen</methodname>
      <methodparam><type>string</type><parameter>nomefile</parameter></methodparam>
      <methodparam><type>string</type><parameter>modo</parameter></methodparam>
     </methodsynopsis>
    <para>
     Apre un file bzip2 (.bz2) in lettura o scrittura.
     <parameter>nomefile</parameter> &egrave; il nome del file da
     aprire. Il parametro <parameter>modo</parameter> egrave; simile a quello
     della funzione <function>fopen</function> (`r' per lettura, `w' per scrittura, ecc.).
    </para>
    <para>
     Se l'operazione fallisce, la funzione restituisce &false;, altrimenti
     restituisce un puntatore al file appena aperto.
    </para>
    <para>
     <example>
      <title>Esempio di<function>bzopen</function></title>
      <programlisting role="php">
<![CDATA[
<?php
$bz = bzopen("/tmp/foo.bz2", "r");
$file_decompresso = bzread($bz, filesize("/tmp/foo.bz2"));
bzclose($bz);

print( "Il contenuto di /tmp/foo.bz2 : " );
print( "\n<br>n" );
print( $file_decompresso );
?>
]]>
      </programlisting>
     </example>
    </para>
    <para>
     Vedere anche <function>bzclose</function>.
    </para>
   </refsect1>
  </refentry>


  <refentry id="function.bzread">
   <refnamediv>
    <refname>bzread</refname>
    <refpurpose>Esegue la lettura binaria di un file bzip2</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Descrizione</title>
     <methodsynopsis>
      <type>string</type><methodname>bzread</methodname>
      <methodparam><type>int</type><parameter>bz</parameter></methodparam>
      <methodparam choice="opt"><type>int</type><parameter>lunghezza</parameter></methodparam>
     </methodsynopsis>
    <para>
     <function>bzread</function> legge fino a 
     <parameter>lunghezza</parameter> byte dal puntatore bzip2
     specificato da <parameter>bz</parameter>.  La pettura termina quando
     <parameter>lunghezza</parameter> byte (decompressi) sono stati letti
     o quando viene raggiunto l'EOF.  Se il parametro
     opzionale <parameter>lunghezza</parameter> &egrave; omesso,
     <function>bzread</function> legger&agrave; 1024 byte (decompressi)
     ogni volta.
    </para>
    <para>
     <example>
      <title>Esempio di <function>bzread</function></title>
      <programlisting role="php">
<![CDATA[
<?php
$bz = bzopen("/tmp/foo.bz2", "r");
$str = bzread($bz, 2048);
print( $str );
?>
]]>
      </programlisting>
     </example>
    </para>
    <para>
     Vedere anche <function>bzwrite</function> e <function>bzopen</function>.
    </para>
   </refsect1>
  </refentry>


  <refentry id="function.bzwrite">
   <refnamediv>
    <refname>bzwrite</refname>
    <refpurpose>Esegue la scrittura binaria di un file bzip2</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Descrizione</title>
     <methodsynopsis>
      <type>int</type><methodname>bzwrite</methodname>
      <methodparam><type>int</type><parameter>bz</parameter></methodparam>
      <methodparam><type>string</type><parameter>dati</parameter></methodparam>
      <methodparam choice="opt"><type>int</type><parameter>lunghezza</parameter></methodparam>
     </methodsynopsis>
    <para>
     <function>bzwrite</function> scrie il contenuto della stringa
     <parameter>dati</parameter> nel file bzip2 puntato
     da <parameter>bz</parameter>. Se il parametro
     opzionale <parameter>lunghezza</parameter> &egrave; specificato, la scrittura si fermer&agrave;
     dopo che siano stati scritti <parameter>lunghezza</parameter> byte (decompressi)  o al raggiungimento
     della fine della stringa.
    </para>
    <para>
     <example>
      <title>Esempio di <function>bzwrite</function></title>
      <programlisting role="php">
<![CDATA[
<?php
$str = "dati non compressi";
$bz = bzopen("/tmp/foo.bz2", "w");
bzwrite($bz, $str, strlen($str));
bzclose($bz);
?>
]]>
      </programlisting> 
     </example>
    </para>
    <para>
     Vedere anche <function>bzread</function> e <function>bzopen</function>.
    </para>
   </refsect1>
  </refentry>


 </reference>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->