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 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723
|
<?xml version="1.0" encoding="ISO-8859-1"?>
<fpdoc-descriptions>
<package name="fcl">
<!--
====================================================================
zstream
====================================================================
-->
<module name="zstream">
<short>Support for compression streams</short>
<descr>
<p>
The <file>ZStream</file> unit implements a <link id="#rtl.classes.TStream">TStream</link>
descendent (<link id="TCompressionStream"/>) which uses the deflate algorithm to compress
everything that is written to it. The compressed data is written to the output stream, which is
specified when the compressor class is created.
</p>
<p>
Likewise, a <var>TStream</var> descendent is implemented which reads data
from an input stream (<link id="TDecompressionStream"/>) and decompresses
it with the inflate algorithm.
</p>
</descr>
<!-- uses unit Visibility: default -->
<element name="zbase">
<short>Basic zip types</short>
</element>
<!-- unresolved type reference Visibility: default -->
<element name="Sysutils">
<short>Used for exception support.</short>
</element>
<!-- unresolved type reference Visibility: default -->
<element name="Classes">
<short>Used for the TStream declaration</short>
</element>
<!-- unresolved type reference Visibility: default -->
<element name="paszlib">
<short>Support for the deflate algorithm</short>
</element>
<!-- object Visibility: default -->
<element name="EZlibError">
<short>Base exception for exceptions in the ZStream unit</short>
<descr>
Errors which occur in the <file>zstream</file> unit are signaled by
raising an <var>EZLibError</var> exception descendent.
</descr>
</element>
<!-- object Visibility: default -->
<element name="ECompressionError">
<short>Errors in the <link id="#fcl.zstream.TCompressionStream">TCompressionStream</link>
class are signaled with this exception</short>
<descr>
<var>ECompressionError</var> is the exception class used by the <link
id="TCompressionStream"/> class.
</descr>
</element>
<!-- object Visibility: default -->
<element name="EDecompressionError">
<short>Errors in the <link
id="#fcl.zstream.TDeCompressionStream">TDeCompressionStream</link>
class are signaled with this exception</short>
<descr>
<var>EDecompressionError</var> is the exception class used by the <link
id="TDeCompressionStream"/> class.
</descr>
</element>
<!-- object Visibility: default -->
<element name="TCustomZlibStream">
<short>Ancestor for compression and decompression classes</short>
<descr>
<p>
<var>TCustomZlibStream</var> serves as the ancestor class for the
<link id="TCompressionStream"/> and <link id="TDeCompressionStream"/>
classes.
</p>
<p>
It introduces support for a progress handler, and stores the input or
output stream.
</p>
</descr>
</element>
<!-- constructor Visibility: public -->
<element name="TCustomZlibStream.Create">
<short>Create a new instance of <var>TCustomZlibStream</var></short>
<descr>
<var>Create</var> creates a new instance of <var>TCustomZlibStream</var>. It
stores a reference to the input/output stream, and initializes the
deflate compression mechanism so they can be used by the descendents.
</descr>
<seealso>
<link id="TCompressionStream"/>
<link id="TDecompressionStream"/>
</seealso>
</element>
<!-- argument Visibility: default -->
<element name="TCustomZlibStream.Create.Strm">
<short>Instance of the Input/Output stream</short>
</element>
<element name="TDecompressionStream.Create.ASkipHeader">
<short></short>
</element>
<!-- enumeration type Visibility: default -->
<element name="TCompressionLevel">
<short>Compression level for the deflate algorithm</short>
</element>
<!-- enumeration value Visibility: default -->
<element name="TCompressionLevel.clNone">
<short>Do not use compression, just copy data.</short>
</element>
<!-- enumeration value Visibility: default -->
<element name="TCompressionLevel.clFastest">
<short>Use fast (but less) compression.</short>
</element>
<!-- enumeration value Visibility: default -->
<element name="TCompressionLevel.clDefault">
<short>Use default compression</short>
</element>
<!-- enumeration value Visibility: default -->
<element name="TCompressionLevel.clMax">
<short>Use maximum compression</short>
</element>
<!-- object Visibility: default -->
<element name="TCompressionStream">
<short>Write-only stream class which compresses data written to it.</short>
<descr>
<var>TCompressionStream</var>
</descr>
<errors>
</errors>
<seealso>
</seealso>
</element>
<!-- constructor Visibility: public -->
<element name="TCompressionStream.Create">
<short>Create a new instance of the compression stream.</short>
<descr>
<p>
<var>Create</var> creates a new instance of the compression stream.
It merely calls the inherited constructor with the destination stream
<var>Dest</var> and stores the compression level.
</p>
<p>
If <var>ASkipHeader</var> is set to <var>True</var>, the method will not
write the block header to the stream. This is required for deflated data
in a zip file.
</p>
<p>Note that the compressed data is only completely written after the
compression stream is destroyed.
</p>
</descr>
<seealso>
<link id="TCompressionStream.Destroy">Destroy</link>
</seealso>
</element>
<!-- argument Visibility: default -->
<element name="TCompressionStream.Create.CompressionLevel">
<short>Compression level to use when writing data to the stream</short>
</element>
<!-- argument Visibility: default -->
<element name="TCompressionStream.Create.Dest">
<short>Output stream to which compressed data is written.</short>
</element>
<!-- argument Visibility: default -->
<element name="TCompressionStream.Create.ASkipHeader">
<short>If set, the deflated data block header is not written to stream</short>
</element>
<!-- destructor Visibility: public -->
<element name="TCompressionStream.Destroy">
<short>Flushes data to the output stream and destroys the compression stream.</short>
<descr>
<var>Destroy</var> flushes the output stream: any compressed data not yet
written to the output stream are written, and the deflate structures are
cleaned up.
</descr>
<errors>
None.
</errors>
<seealso>
<link id="TCompressionStream.Create">Create</link>
</seealso>
</element>
<!-- function Visibility: public -->
<element name="TCompressionStream.Write">
<short>Write data to the stream</short>
<descr>
<var>Write</var> takes <var>Count</var> bytes from <var>Buffer</var>
and compresses (deflates) them. The compressed result is written
to the output stream.
</descr>
<errors>
If an error occurs, an <link id="ECompressionError"/> exception is raised.
</errors>
<seealso>
<link id="TCompressionStream.Write">Write</link>
<link id="ECompressionError"/>
</seealso>
</element>
<!-- function result Visibility: default -->
<element name="TCompressionStream.Write.Result">
<short>Number of (uncompressed) bytes actually written</short>
</element>
<!-- argument Visibility: default -->
<element name="TCompressionStream.Write.Buffer">
<short>Buffer to take data from.</short>
</element>
<!-- argument Visibility: default -->
<element name="TCompressionStream.Write.Count">
<short>Number of bytes to take from the buffer.</short>
</element>
<!-- property Visibility: public -->
<element name="TCompressionStream.OnProgress">
<short>Progress handler</short>
<descr>
<var>OnProgress</var> is called whenever output data is written to the
output stream. It can be used to update a progress bar or so. The
<var>Sender</var> argument to the progress handler is the compression stream
instance.
</descr>
</element>
<!-- object Visibility: default -->
<element name="TDecompressionStream">
<short>Reads and decompresses data from a compressed data stream.</short>
<descr>
<p>
<var>TDecompressionStream</var> performs the inverse operation of
<link id="TCompressionStream"/>. A read operation reads data from an input
stream and decompresses (inflates) the data it as it goes along.
</p>
<p>
The decompression stream reads it's compressed data from a stream with
deflated data. This data can be created e.g. with a <link id="TCompressionStream"/>
compression stream.
</p>
</descr>
<seealso>
<link id="TCompressionStream"/>
</seealso>
</element>
<!-- constructor Visibility: public -->
<element name="TDecompressionStream.Create">
<short>Creates a new instance of the <var>TDecompressionStream</var> stream</short>
<descr>
<p>
<var>Create</var> creates and initializes a new instance of the <var>TDecompressionStream</var>
class. It calls the inherited <var>Create</var> and passes it the
<var>Source</var> stream. The source stream is the stream from which the
compressed (deflated) data is read.
</p>
<p>
If <var>ASkipHeader</var> is true, then the gzip data header is skipped,
allowing <var>TDecompressionStream</var> to read deflated data in a .zip
file. (this data does not have the gzip header record prepended to it).
</p>
<p>
Note that the source stream is by default not owned by the decompression
stream, and is not freed when the decompression stream is destroyed.
</p>
</descr>
<seealso>
<link id="TDecompressionStream.Destroy">Destroy</link>
</seealso>
</element>
<!-- argument Visibility: default -->
<element name="TDecompressionStream.Create.ASource">
<short>Stream with compressed data</short>
</element>
<element name="TDecompressionStream.Create.ASkipHeader">
<short>Should the header data be skipped.</short>
</element>
<!-- destructor Visibility: public -->
<element name="TDecompressionStream.Destroy">
<short>Destroys the <var>TDecompressionStream</var> instance</short>
<descr>
<p>
<var>Destroy</var> cleans up the inflate structure, and then simply
calls the inherited destroy.
</p>
<p>
By default the source stream is not freed when calling <var>Destroy</var>.
</p>
</descr>
<seealso>
<link id="TDecompressionStream.Create">Create</link>
</seealso>
</element>
<!-- function Visibility: public -->
<element name="TDecompressionStream.Read">
<short>Read data from the compressed stream</short>
<descr>
<var>Read</var> will read data from the compressed stream until the
decompressed data size is <var>Count</var> or there is no more compressed
data available. The decompressed data is written in <var>Buffer</var>.
The function returns the number of bytes written in the buffer.
</descr>
<errors>
If an error occurs, an <link id="EDeCompressionError"/> exception is raised.
</errors>
<seealso>
<link id="TCompressionStream.Write">Write</link>
</seealso>
</element>
<!-- function result Visibility: default -->
<element name="TDecompressionStream.Read.Result">
<short>Number of decompressed bytes that were actually read</short>
</element>
<!-- argument Visibility: default -->
<element name="TDecompressionStream.Read.Buffer">
<short>Buffer in which to store the read data</short>
</element>
<!-- argument Visibility: default -->
<element name="TDecompressionStream.Read.Count">
<short>Maximum number of bytes to read.</short>
</element>
<!-- function Visibility: public -->
<element name="TDecompressionStream.Write">
<short>Write data to the stream</short>
<descr>
<var>Write</var> will raise a <link id="EDeCompressionError"/> exception,
because the <var>TDecompressionStream</var> class is read-only.
</descr>
<errors>
An <link id="EDeCompressionError"/> exception is always raised.
</errors>
<seealso>
<link id="TDeCompressionStream.Read">Read</link>
<link id="EDeCompressionError"/>
</seealso>
</element>
<!-- function result Visibility: default -->
<element name="TDecompressionStream.Write.Result">
<short>Number of bytes written</short>
</element>
<!-- argument Visibility: default -->
<element name="TDecompressionStream.Write.Buffer">
<short>Buffer containing the data to be written</short>
</element>
<!-- argument Visibility: default -->
<element name="TDecompressionStream.Write.Count">
<short>Number of bytes to write</short>
</element>
<!-- function Visibility: public -->
<element name="TDecompressionStream.Seek">
<short>Move stream position to a certain location in the stream.</short>
<descr>
<p>
<var>Seek</var> overrides the standard <var>Seek</var> implementation.
There are a few differences between the implementation of <var>Seek</var>
in Free Pascal compared to Delphi:
</p>
<ul>
<li>In Free Pascal, you can perform any seek. In case of a forward seek,
the Free Pascal implementation will read some bytes until the desired
position is reached, in case of a backward seek it will seek the
source stream backwards to the position it had at the creation time
of the <var>TDecompressionStream</var> and then again read some bytes
until the desired position has been reached.</li>
<li>In Free Pascal, a seek with soFromBeginning will reset the source
stream to the position it had when the <var>TDecompressionStream</var>
was created. In Delphi, the source stream is reset to position 0.
This means that at creation time the source stream must always be at
the start of the zstream, you cannot use <var>TDecompressionStream.Seek</var>
to reset the source stream to the begin of the file.</li>
</ul>
</descr>
<errors>
An <link id="EDecompressionError"/> exception is raised if the stream does not
allow the requested seek operation.
</errors>
<seealso>
<link id="TDecompressionStream.Read">Read</link>
</seealso>
</element>
<!-- function result Visibility: default -->
<element name="TDecompressionStream.Seek.Result">
<short>New position in the stream</short>
</element>
<!-- argument Visibility: default -->
<element name="TDecompressionStream.Seek.Offset">
<short>Offset to apply to the position in the stream</short>
</element>
<!-- argument Visibility: default -->
<element name="TDecompressionStream.Seek.Origin">
<short>Origin from where <var>Offset</var> should be counted.</short>
</element>
<!-- property Visibility: public -->
<element name="TDeCompressionStream.OnProgress">
<short>Progress handler</short>
<descr>
<var>OnProgress</var> is called whenever input data is read from the
source stream. It can be used to update a progress bar or so. The
<var>Sender</var> argument to the progress handler is the decompression stream
instance.
</descr>
</element>
<!-- enumeration type Visibility: default -->
<element name="TGZOpenMode">
<short>Open mode for gzip file.</short>
</element>
<!-- enumeration value Visibility: default -->
<element name="TGZOpenMode.gzOpenRead">
<short>Open file for reading</short>
</element>
<!-- enumeration value Visibility: default -->
<element name="TGZOpenMode.gzOpenWrite">
<short>Open file for writing</short>
</element>
<!-- object Visibility: default -->
<element name="TGZFileStream">
<short>Stream to read/write from a gzip file.</short>
<descr>
<var>TGZFileStream</var> can be used to read data from a gzip file, or to
write data to a gzip file.
</descr>
<seealso>
<link id="TCompressionStream"/>
<link id="TDeCompressionStream"/>
</seealso>
</element>
<!-- constructor Visibility: public -->
<element name="TGZFileStream.Create">
<short>Create a new instance of <var>TGZFileStream</var></short>
<descr>
<p>
<var>Create</var> creates a new instance of the <var>TGZFileStream</var>
class. It opens <var>FileName</var> for reading or writing, depending on
the <var>FileMode</var> parameter. It is not possible to open the file
read-write. If the file is opened for reading, it must exist.
</p>
<p>
If the file is opened for reading, the <link id="TGZFileStream.Read"/>
method can be used for reading the data in uncompressed form.
</p>
<p>
If the file is opened for writing, any data written using
the <link id="TGZFileStream.Write"/> method will be stored
in the file in compressed (deflated) form.
</p>
</descr>
<errors>
If the file is not found, an <link id="EZlibError"/> exception is raised.
</errors>
<seealso>
<link id="TGZFileStream.Destroy">Destroy</link>
<link id="TGZOpenMode">TGZOpenMode</link>
</seealso>
</element>
<!-- argument Visibility: default -->
<element name="TGZFileStream.Create.FileName">
<short>Name of the gzip file</short>
</element>
<!-- argument Visibility: default -->
<element name="TGZFileStream.Create.FileMode">
<short>Open mode for the file.</short>
</element>
<!-- destructor Visibility: public -->
<element name="TGZFileStream.Destroy">
<short>Removes <var>TGZFileStream</var> instance</short>
<descr>
<var>Destroy</var> closes the file and releases the <var>TGZFileStream</var>
instance from memory.
</descr>
<seealso>
<link id="TGZFileStream.Create">Create</link>
</seealso>
</element>
<!-- function Visibility: public -->
<element name="TGZFileStream.Read">
<short>Read data from the compressed file</short>
<descr>
<p>
<var>Read</var> overrides the <var>Read</var> method of <var>TStream</var>
to read the data from the compressed file. The <var>Buffer</var> parameter
indicates where the read data should be stored. The <var>Count</var>
parameter specifies the number of bytes (<em>uncompressed</em>) that should
be read from the compressed file. Note that it is
not possible to read from the stream if it was opened in write mode.
</p>
<p>
The function returns the number of uncompressed bytes actually read.
</p>
</descr>
<errors>
If <var>Buffer</var> points to an invalid location, or does not have enough
room for <var>Count</var> bytes, an exception will be raised.
</errors>
<seealso>
<link id="TGZFileStream.Create">Create</link>
<link id="TGZFileStream.Write">Write</link>
<link id="TGZFileStream.Seek">Seek</link>
</seealso>
</element>
<!-- function result Visibility: default -->
<element name="TGZFileStream.Read.Result">
<short>Number of bytes (uncompressed) actually read</short>
</element>
<!-- argument Visibility: default -->
<element name="TGZFileStream.Read.Buffer">
<short>Memory buffer to store the data in</short>
</element>
<!-- argument Visibility: default -->
<element name="TGZFileStream.Read.Count">
<short>Number of (uncompressed) bytes to read.</short>
</element>
<!-- function Visibility: public -->
<element name="TGZFileStream.Write">
<short>Write data to be compressed</short>
<descr>
<p>
<var>Write</var> writes <var>Count</var> bytes from <var>Buffer</var> to the
compressed file. The data is compressed as it is written, so ideally, less
than <var>Count</var> bytes end up in the compressed file. Note that it is
not possible to write to the stream if it was opened in read mode.
</p>
<p>
The function returns the number of (uncompressed) bytes that were actually
written.
</p>
</descr>
<errors>
In case of an error, an <link id="EZlibError"/> exception is raised.
</errors>
<seealso>
<link id="TGZFileStream.Create">Create</link>
<link id="TGZFileStream.Read">Read</link>
<link id="TGZFileStream.Seek">Seek</link>
</seealso>
</element>
<!-- function result Visibility: default -->
<element name="TGZFileStream.Write.Result">
<short>Number of uncompressed bytes written</short>
</element>
<!-- argument Visibility: default -->
<element name="TGZFileStream.Write.Buffer">
<short>Memory location containing the data to be written.</short>
</element>
<!-- argument Visibility: default -->
<element name="TGZFileStream.Write.Count">
<short>Number of bytes to write.</short>
</element>
<!-- function Visibility: public -->
<element name="TGZFileStream.Seek">
<short>Set the position in the compressed stream.</short>
<descr>
<var>Seek</var> sets the position to <var>Offset</var> bytes, starting from
<var>Origin</var>. Not all combinations are possible, see
<link id="TDecompressionStream.Seek"/> for a list of possibilities.
</descr>
<errors>
In case an impossible combination is asked, an <link id="EZlibError"/> exception
is raised.
</errors>
<seealso>
<link id="TDecompressionStream.Seek"/>
</seealso>
</element>
<!-- function result Visibility: default -->
<element name="TGZFileStream.Seek.Result">
<short>New position in the stream</short>
</element>
<!-- argument Visibility: default -->
<element name="TGZFileStream.Seek.Offset">
<short>Number of bytes to position on</short>
</element>
<!-- argument Visibility: default -->
<element name="TGZFileStream.Seek.Origin">
<short>Where to start positioning</short>
</element>
<!-- argument Visibility: default -->
<element name="Tcustomzlibstream.create.stream">
<short>Source or target stream</short>
</element>
<!-- destructor Visibility: public -->
<element name="Tcustomzlibstream.destroy">
<short>Clear up instance</short>
<descr>
<var>Destroy</var> cleans up the internal memory buffer and calls the
inherited destroy.
</descr>
<seealso>
<link id="Tcustomzlibstream.create"/>
</seealso>
</element>
<!-- argument Visibility: default -->
<element name="Tcompressionstream.create.level">
<short>Compression level for compression stream</short>
</element>
<!-- procedure Visibility: public -->
<element name="Tcompressionstream.flush">
<short>Flush remaining data to the target stream</short>
<descr>
<var>flush</var> writes any remaining data in the memory buffers
to the target stream, and clears the memory buffer.
</descr>
</element>
<!-- function Visibility: public -->
<element name="Tcompressionstream.get_compressionrate">
<short>Get the current compression rate</short>
<descr>
<var>get_compressionrate</var> returns the percentage of the number of
written compressed bytes relative to the number of written bytes.
</descr>
<errors>
If no bytes were written, an exception is raised.
</errors>
</element>
<!-- function result Visibility: default -->
<element name="Tcompressionstream.get_compressionrate.Result">
<short>Percentage of compression</short>
</element>
<!-- function Visibility: public -->
<element name="Tdecompressionstream.get_compressionrate">
<short>Get the current compression rate</short>
<descr>
<var>get_compressionrate</var> returns the percentage of the number of
read compressed bytes relative to the total number of read bytes.
</descr>
<errors>
If no bytes were written, an exception is raised.
</errors>
</element>
<!-- function result Visibility: default -->
<element name="Tdecompressionstream.get_compressionrate.Result">
<short>Percentage of compression</short>
</element>
<!--
********************************************************************
#fcl.zstream.Egzfileerror
********************************************************************
-->
<!-- object Visibility: default -->
<element name="Egzfileerror">
<short>Exception class used in <link id="#fcl.zstream.Tgzfilestream">Tgzfilestream</link>
class</short>
<descr>
<var>Egzfileerror</var> is the exception class used to report errors by the
<link id="Tgzfilestream"/> class.
</descr>
<seealso>
<link id="Tgzfilestream"/>
</seealso>
</element>
</module> <!-- zstream -->
</package>
</fpdoc-descriptions>
|