1package IO::Compress::Deflate ; 2 3require 5.006 ; 4 5use strict ; 6use warnings; 7use bytes; 8 9require Exporter ; 10 11use IO::Compress::RawDeflate 2.093 (); 12use IO::Compress::Adapter::Deflate 2.093 ; 13 14use IO::Compress::Zlib::Constants 2.093 ; 15use IO::Compress::Base::Common 2.093 qw(); 16 17 18our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, %DEFLATE_CONSTANTS, $DeflateError); 19 20$VERSION = '2.093'; 21$DeflateError = ''; 22 23@ISA = qw(IO::Compress::RawDeflate Exporter); 24@EXPORT_OK = qw( $DeflateError deflate ) ; 25%EXPORT_TAGS = %IO::Compress::RawDeflate::DEFLATE_CONSTANTS ; 26 27push @{ $EXPORT_TAGS{all} }, @EXPORT_OK ; 28Exporter::export_ok_tags('all'); 29 30 31sub new 32{ 33 my $class = shift ; 34 35 my $obj = IO::Compress::Base::Common::createSelfTiedObject($class, \$DeflateError); 36 return $obj->_create(undef, @_); 37} 38 39sub deflate 40{ 41 my $obj = IO::Compress::Base::Common::createSelfTiedObject(undef, \$DeflateError); 42 return $obj->_def(@_); 43} 44 45 46sub bitmask($$$$) 47{ 48 my $into = shift ; 49 my $value = shift ; 50 my $offset = shift ; 51 my $mask = shift ; 52 53 return $into | (($value & $mask) << $offset ) ; 54} 55 56sub mkDeflateHdr($$$;$) 57{ 58 my $method = shift ; 59 my $cinfo = shift; 60 my $level = shift; 61 my $fdict_adler = shift ; 62 63 my $cmf = 0; 64 my $flg = 0; 65 my $fdict = 0; 66 $fdict = 1 if defined $fdict_adler; 67 68 $cmf = bitmask($cmf, $method, ZLIB_CMF_CM_OFFSET, ZLIB_CMF_CM_BITS); 69 $cmf = bitmask($cmf, $cinfo, ZLIB_CMF_CINFO_OFFSET, ZLIB_CMF_CINFO_BITS); 70 71 $flg = bitmask($flg, $fdict, ZLIB_FLG_FDICT_OFFSET, ZLIB_FLG_FDICT_BITS); 72 $flg = bitmask($flg, $level, ZLIB_FLG_LEVEL_OFFSET, ZLIB_FLG_LEVEL_BITS); 73 74 my $fcheck = 31 - ($cmf * 256 + $flg) % 31 ; 75 $flg = bitmask($flg, $fcheck, ZLIB_FLG_FCHECK_OFFSET, ZLIB_FLG_FCHECK_BITS); 76 77 my $hdr = pack("CC", $cmf, $flg) ; 78 $hdr .= pack("N", $fdict_adler) if $fdict ; 79 80 return $hdr; 81} 82 83sub mkHeader 84{ 85 my $self = shift ; 86 my $param = shift ; 87 88 my $level = $param->getValue('level'); 89 my $strategy = $param->getValue('strategy'); 90 91 my $lflag ; 92 $level = 6 93 if $level == Z_DEFAULT_COMPRESSION ; 94 95 if (ZLIB_VERNUM >= 0x1210) 96 { 97 if ($strategy >= Z_HUFFMAN_ONLY || $level < 2) 98 { $lflag = ZLIB_FLG_LEVEL_FASTEST } 99 elsif ($level < 6) 100 { $lflag = ZLIB_FLG_LEVEL_FAST } 101 elsif ($level == 6) 102 { $lflag = ZLIB_FLG_LEVEL_DEFAULT } 103 else 104 { $lflag = ZLIB_FLG_LEVEL_SLOWEST } 105 } 106 else 107 { 108 $lflag = ($level - 1) >> 1 ; 109 $lflag = 3 if $lflag > 3 ; 110 } 111 112 #my $wbits = (MAX_WBITS - 8) << 4 ; 113 my $wbits = 7; 114 mkDeflateHdr(ZLIB_CMF_CM_DEFLATED, $wbits, $lflag); 115} 116 117sub ckParams 118{ 119 my $self = shift ; 120 my $got = shift; 121 122 $got->setValue('adler32' => 1); 123 return 1 ; 124} 125 126 127sub mkTrailer 128{ 129 my $self = shift ; 130 return pack("N", *$self->{Compress}->adler32()) ; 131} 132 133sub mkFinalTrailer 134{ 135 return ''; 136} 137 138#sub newHeader 139#{ 140# my $self = shift ; 141# return *$self->{Header}; 142#} 143 144sub getExtraParams 145{ 146 my $self = shift ; 147 return $self->getZlibParams(), 148} 149 150sub getInverseClass 151{ 152 return ('IO::Uncompress::Inflate', 153 \$IO::Uncompress::Inflate::InflateError); 154} 155 156sub getFileInfo 157{ 158 my $self = shift ; 159 my $params = shift; 160 my $file = shift ; 161 162} 163 164 165 1661; 167 168__END__ 169 170=head1 NAME 171 172IO::Compress::Deflate - Write RFC 1950 files/buffers 173 174=head1 SYNOPSIS 175 176 use IO::Compress::Deflate qw(deflate $DeflateError) ; 177 178 my $status = deflate $input => $output [,OPTS] 179 or die "deflate failed: $DeflateError\n"; 180 181 my $z = new IO::Compress::Deflate $output [,OPTS] 182 or die "deflate failed: $DeflateError\n"; 183 184 $z->print($string); 185 $z->printf($format, $string); 186 $z->write($string); 187 $z->syswrite($string [, $length, $offset]); 188 $z->flush(); 189 $z->tell(); 190 $z->eof(); 191 $z->seek($position, $whence); 192 $z->binmode(); 193 $z->fileno(); 194 $z->opened(); 195 $z->autoflush(); 196 $z->input_line_number(); 197 $z->newStream( [OPTS] ); 198 199 $z->deflateParams(); 200 201 $z->close() ; 202 203 $DeflateError ; 204 205 # IO::File mode 206 207 print $z $string; 208 printf $z $format, $string; 209 tell $z 210 eof $z 211 seek $z, $position, $whence 212 binmode $z 213 fileno $z 214 close $z ; 215 216=head1 DESCRIPTION 217 218This module provides a Perl interface that allows writing compressed 219data to files or buffer as defined in RFC 1950. 220 221For reading RFC 1950 files/buffers, see the companion module 222L<IO::Uncompress::Inflate|IO::Uncompress::Inflate>. 223 224=head1 Functional Interface 225 226A top-level function, C<deflate>, is provided to carry out 227"one-shot" compression between buffers and/or files. For finer 228control over the compression process, see the L</"OO Interface"> 229section. 230 231 use IO::Compress::Deflate qw(deflate $DeflateError) ; 232 233 deflate $input_filename_or_reference => $output_filename_or_reference [,OPTS] 234 or die "deflate failed: $DeflateError\n"; 235 236The functional interface needs Perl5.005 or better. 237 238=head2 deflate $input_filename_or_reference => $output_filename_or_reference [, OPTS] 239 240C<deflate> expects at least two parameters, 241C<$input_filename_or_reference> and C<$output_filename_or_reference> 242and zero or more optional parameters (see L</Optional Parameters>) 243 244=head3 The C<$input_filename_or_reference> parameter 245 246The parameter, C<$input_filename_or_reference>, is used to define the 247source of the uncompressed data. 248 249It can take one of the following forms: 250 251=over 5 252 253=item A filename 254 255If the C<$input_filename_or_reference> parameter is a simple scalar, it is 256assumed to be a filename. This file will be opened for reading and the 257input data will be read from it. 258 259=item A filehandle 260 261If the C<$input_filename_or_reference> parameter is a filehandle, the input 262data will be read from it. The string '-' can be used as an alias for 263standard input. 264 265=item A scalar reference 266 267If C<$input_filename_or_reference> is a scalar reference, the input data 268will be read from C<$$input_filename_or_reference>. 269 270=item An array reference 271 272If C<$input_filename_or_reference> is an array reference, each element in 273the array must be a filename. 274 275The input data will be read from each file in turn. 276 277The complete array will be walked to ensure that it only 278contains valid filenames before any data is compressed. 279 280=item An Input FileGlob string 281 282If C<$input_filename_or_reference> is a string that is delimited by the 283characters "<" and ">" C<deflate> will assume that it is an 284I<input fileglob string>. The input is the list of files that match the 285fileglob. 286 287See L<File::GlobMapper|File::GlobMapper> for more details. 288 289=back 290 291If the C<$input_filename_or_reference> parameter is any other type, 292C<undef> will be returned. 293 294=head3 The C<$output_filename_or_reference> parameter 295 296The parameter C<$output_filename_or_reference> is used to control the 297destination of the compressed data. This parameter can take one of 298these forms. 299 300=over 5 301 302=item A filename 303 304If the C<$output_filename_or_reference> parameter is a simple scalar, it is 305assumed to be a filename. This file will be opened for writing and the 306compressed data will be written to it. 307 308=item A filehandle 309 310If the C<$output_filename_or_reference> parameter is a filehandle, the 311compressed data will be written to it. The string '-' can be used as 312an alias for standard output. 313 314=item A scalar reference 315 316If C<$output_filename_or_reference> is a scalar reference, the 317compressed data will be stored in C<$$output_filename_or_reference>. 318 319=item An Array Reference 320 321If C<$output_filename_or_reference> is an array reference, 322the compressed data will be pushed onto the array. 323 324=item An Output FileGlob 325 326If C<$output_filename_or_reference> is a string that is delimited by the 327characters "<" and ">" C<deflate> will assume that it is an 328I<output fileglob string>. The output is the list of files that match the 329fileglob. 330 331When C<$output_filename_or_reference> is an fileglob string, 332C<$input_filename_or_reference> must also be a fileglob string. Anything 333else is an error. 334 335See L<File::GlobMapper|File::GlobMapper> for more details. 336 337=back 338 339If the C<$output_filename_or_reference> parameter is any other type, 340C<undef> will be returned. 341 342=head2 Notes 343 344When C<$input_filename_or_reference> maps to multiple files/buffers and 345C<$output_filename_or_reference> is a single 346file/buffer the input files/buffers will be stored 347in C<$output_filename_or_reference> as a concatenated series of compressed data streams. 348 349=head2 Optional Parameters 350 351The optional parameters for the one-shot function C<deflate> 352are (for the most part) identical to those used with the OO interface defined in the 353L</"Constructor Options"> section. The exceptions are listed below 354 355=over 5 356 357=item C<< AutoClose => 0|1 >> 358 359This option applies to any input or output data streams to 360C<deflate> that are filehandles. 361 362If C<AutoClose> is specified, and the value is true, it will result in all 363input and/or output filehandles being closed once C<deflate> has 364completed. 365 366This parameter defaults to 0. 367 368=item C<< BinModeIn => 0|1 >> 369 370This option is now a no-op. All files will be read in binmode. 371 372=item C<< Append => 0|1 >> 373 374The behaviour of this option is dependent on the type of output data 375stream. 376 377=over 5 378 379=item * A Buffer 380 381If C<Append> is enabled, all compressed data will be append to the end of 382the output buffer. Otherwise the output buffer will be cleared before any 383compressed data is written to it. 384 385=item * A Filename 386 387If C<Append> is enabled, the file will be opened in append mode. Otherwise 388the contents of the file, if any, will be truncated before any compressed 389data is written to it. 390 391=item * A Filehandle 392 393If C<Append> is enabled, the filehandle will be positioned to the end of 394the file via a call to C<seek> before any compressed data is 395written to it. Otherwise the file pointer will not be moved. 396 397=back 398 399When C<Append> is specified, and set to true, it will I<append> all compressed 400data to the output data stream. 401 402So when the output is a filehandle it will carry out a seek to the eof 403before writing any compressed data. If the output is a filename, it will be opened for 404appending. If the output is a buffer, all compressed data will be 405appended to the existing buffer. 406 407Conversely when C<Append> is not specified, or it is present and is set to 408false, it will operate as follows. 409 410When the output is a filename, it will truncate the contents of the file 411before writing any compressed data. If the output is a filehandle 412its position will not be changed. If the output is a buffer, it will be 413wiped before any compressed data is output. 414 415Defaults to 0. 416 417=back 418 419=head2 Examples 420 421Here are a few example that show the capabilities of the module. 422 423=head3 Streaming 424 425This very simple command line example demonstrates the streaming capabilities of the module. 426The code reads data from STDIN, compresses it, and writes the compressed data to STDOUT. 427 428 $ echo hello world | perl -MIO::Compress::Deflate=deflate -e 'deflate \*STDIN => \*STDOUT' >output.1950 429 430The special filename "-" can be used as a standin for both C<\*STDIN> and C<\*STDOUT>, 431so the above can be rewritten as 432 433 $ echo hello world | perl -MIO::Compress::Deflate=deflate -e 'deflate "-" => "-"' >output.1950 434 435=head3 Compressing a file from the filesystem 436 437To read the contents of the file C<file1.txt> and write the compressed 438data to the file C<file1.txt.1950>. 439 440 use strict ; 441 use warnings ; 442 use IO::Compress::Deflate qw(deflate $DeflateError) ; 443 444 my $input = "file1.txt"; 445 deflate $input => "$input.1950" 446 or die "deflate failed: $DeflateError\n"; 447 448=head3 Reading from a Filehandle and writing to an in-memory buffer 449 450To read from an existing Perl filehandle, C<$input>, and write the 451compressed data to a buffer, C<$buffer>. 452 453 use strict ; 454 use warnings ; 455 use IO::Compress::Deflate qw(deflate $DeflateError) ; 456 use IO::File ; 457 458 my $input = new IO::File "<file1.txt" 459 or die "Cannot open 'file1.txt': $!\n" ; 460 my $buffer ; 461 deflate $input => \$buffer 462 or die "deflate failed: $DeflateError\n"; 463 464=head3 Compressing multiple files 465 466To compress all files in the directory "/my/home" that match "*.txt" 467and store the compressed data in the same directory 468 469 use strict ; 470 use warnings ; 471 use IO::Compress::Deflate qw(deflate $DeflateError) ; 472 473 deflate '</my/home/*.txt>' => '<*.1950>' 474 or die "deflate failed: $DeflateError\n"; 475 476and if you want to compress each file one at a time, this will do the trick 477 478 use strict ; 479 use warnings ; 480 use IO::Compress::Deflate qw(deflate $DeflateError) ; 481 482 for my $input ( glob "/my/home/*.txt" ) 483 { 484 my $output = "$input.1950" ; 485 deflate $input => $output 486 or die "Error compressing '$input': $DeflateError\n"; 487 } 488 489=head1 OO Interface 490 491=head2 Constructor 492 493The format of the constructor for C<IO::Compress::Deflate> is shown below 494 495 my $z = new IO::Compress::Deflate $output [,OPTS] 496 or die "IO::Compress::Deflate failed: $DeflateError\n"; 497 498It returns an C<IO::Compress::Deflate> object on success and undef on failure. 499The variable C<$DeflateError> will contain an error message on failure. 500 501If you are running Perl 5.005 or better the object, C<$z>, returned from 502IO::Compress::Deflate can be used exactly like an L<IO::File|IO::File> filehandle. 503This means that all normal output file operations can be carried out 504with C<$z>. 505For example, to write to a compressed file/buffer you can use either of 506these forms 507 508 $z->print("hello world\n"); 509 print $z "hello world\n"; 510 511The mandatory parameter C<$output> is used to control the destination 512of the compressed data. This parameter can take one of these forms. 513 514=over 5 515 516=item A filename 517 518If the C<$output> parameter is a simple scalar, it is assumed to be a 519filename. This file will be opened for writing and the compressed data 520will be written to it. 521 522=item A filehandle 523 524If the C<$output> parameter is a filehandle, the compressed data will be 525written to it. 526The string '-' can be used as an alias for standard output. 527 528=item A scalar reference 529 530If C<$output> is a scalar reference, the compressed data will be stored 531in C<$$output>. 532 533=back 534 535If the C<$output> parameter is any other type, C<IO::Compress::Deflate>::new will 536return undef. 537 538=head2 Constructor Options 539 540C<OPTS> is any combination of zero or more the following options: 541 542=over 5 543 544=item C<< AutoClose => 0|1 >> 545 546This option is only valid when the C<$output> parameter is a filehandle. If 547specified, and the value is true, it will result in the C<$output> being 548closed once either the C<close> method is called or the C<IO::Compress::Deflate> 549object is destroyed. 550 551This parameter defaults to 0. 552 553=item C<< Append => 0|1 >> 554 555Opens C<$output> in append mode. 556 557The behaviour of this option is dependent on the type of C<$output>. 558 559=over 5 560 561=item * A Buffer 562 563If C<$output> is a buffer and C<Append> is enabled, all compressed data 564will be append to the end of C<$output>. Otherwise C<$output> will be 565cleared before any data is written to it. 566 567=item * A Filename 568 569If C<$output> is a filename and C<Append> is enabled, the file will be 570opened in append mode. Otherwise the contents of the file, if any, will be 571truncated before any compressed data is written to it. 572 573=item * A Filehandle 574 575If C<$output> is a filehandle, the file pointer will be positioned to the 576end of the file via a call to C<seek> before any compressed data is written 577to it. Otherwise the file pointer will not be moved. 578 579=back 580 581This parameter defaults to 0. 582 583=item C<< Merge => 0|1 >> 584 585This option is used to compress input data and append it to an existing 586compressed data stream in C<$output>. The end result is a single compressed 587data stream stored in C<$output>. 588 589It is a fatal error to attempt to use this option when C<$output> is not an 590RFC 1950 data stream. 591 592There are a number of other limitations with the C<Merge> option: 593 594=over 5 595 596=item 1 597 598This module needs to have been built with zlib 1.2.1 or better to work. A 599fatal error will be thrown if C<Merge> is used with an older version of 600zlib. 601 602=item 2 603 604If C<$output> is a file or a filehandle, it must be seekable. 605 606=back 607 608This parameter defaults to 0. 609 610=item -Level 611 612Defines the compression level used by zlib. The value should either be 613a number between 0 and 9 (0 means no compression and 9 is maximum 614compression), or one of the symbolic constants defined below. 615 616 Z_NO_COMPRESSION 617 Z_BEST_SPEED 618 Z_BEST_COMPRESSION 619 Z_DEFAULT_COMPRESSION 620 621The default is Z_DEFAULT_COMPRESSION. 622 623Note, these constants are not imported by C<IO::Compress::Deflate> by default. 624 625 use IO::Compress::Deflate qw(:strategy); 626 use IO::Compress::Deflate qw(:constants); 627 use IO::Compress::Deflate qw(:all); 628 629=item -Strategy 630 631Defines the strategy used to tune the compression. Use one of the symbolic 632constants defined below. 633 634 Z_FILTERED 635 Z_HUFFMAN_ONLY 636 Z_RLE 637 Z_FIXED 638 Z_DEFAULT_STRATEGY 639 640The default is Z_DEFAULT_STRATEGY. 641 642=item C<< Strict => 0|1 >> 643 644This is a placeholder option. 645 646=back 647 648=head2 Examples 649 650TODO 651 652=head1 Methods 653 654=head2 print 655 656Usage is 657 658 $z->print($data) 659 print $z $data 660 661Compresses and outputs the contents of the C<$data> parameter. This 662has the same behaviour as the C<print> built-in. 663 664Returns true if successful. 665 666=head2 printf 667 668Usage is 669 670 $z->printf($format, $data) 671 printf $z $format, $data 672 673Compresses and outputs the contents of the C<$data> parameter. 674 675Returns true if successful. 676 677=head2 syswrite 678 679Usage is 680 681 $z->syswrite $data 682 $z->syswrite $data, $length 683 $z->syswrite $data, $length, $offset 684 685Compresses and outputs the contents of the C<$data> parameter. 686 687Returns the number of uncompressed bytes written, or C<undef> if 688unsuccessful. 689 690=head2 write 691 692Usage is 693 694 $z->write $data 695 $z->write $data, $length 696 $z->write $data, $length, $offset 697 698Compresses and outputs the contents of the C<$data> parameter. 699 700Returns the number of uncompressed bytes written, or C<undef> if 701unsuccessful. 702 703=head2 flush 704 705Usage is 706 707 $z->flush; 708 $z->flush($flush_type); 709 710Flushes any pending compressed data to the output file/buffer. 711 712This method takes an optional parameter, C<$flush_type>, that controls 713how the flushing will be carried out. By default the C<$flush_type> 714used is C<Z_FINISH>. Other valid values for C<$flush_type> are 715C<Z_NO_FLUSH>, C<Z_SYNC_FLUSH>, C<Z_FULL_FLUSH> and C<Z_BLOCK>. It is 716strongly recommended that you only set the C<flush_type> parameter if 717you fully understand the implications of what it does - overuse of C<flush> 718can seriously degrade the level of compression achieved. See the C<zlib> 719documentation for details. 720 721Returns true on success. 722 723=head2 tell 724 725Usage is 726 727 $z->tell() 728 tell $z 729 730Returns the uncompressed file offset. 731 732=head2 eof 733 734Usage is 735 736 $z->eof(); 737 eof($z); 738 739Returns true if the C<close> method has been called. 740 741=head2 seek 742 743 $z->seek($position, $whence); 744 seek($z, $position, $whence); 745 746Provides a sub-set of the C<seek> functionality, with the restriction 747that it is only legal to seek forward in the output file/buffer. 748It is a fatal error to attempt to seek backward. 749 750Empty parts of the file/buffer will have NULL (0x00) bytes written to them. 751 752The C<$whence> parameter takes one the usual values, namely SEEK_SET, 753SEEK_CUR or SEEK_END. 754 755Returns 1 on success, 0 on failure. 756 757=head2 binmode 758 759Usage is 760 761 $z->binmode 762 binmode $z ; 763 764This is a noop provided for completeness. 765 766=head2 opened 767 768 $z->opened() 769 770Returns true if the object currently refers to a opened file/buffer. 771 772=head2 autoflush 773 774 my $prev = $z->autoflush() 775 my $prev = $z->autoflush(EXPR) 776 777If the C<$z> object is associated with a file or a filehandle, this method 778returns the current autoflush setting for the underlying filehandle. If 779C<EXPR> is present, and is non-zero, it will enable flushing after every 780write/print operation. 781 782If C<$z> is associated with a buffer, this method has no effect and always 783returns C<undef>. 784 785B<Note> that the special variable C<$|> B<cannot> be used to set or 786retrieve the autoflush setting. 787 788=head2 input_line_number 789 790 $z->input_line_number() 791 $z->input_line_number(EXPR) 792 793This method always returns C<undef> when compressing. 794 795=head2 fileno 796 797 $z->fileno() 798 fileno($z) 799 800If the C<$z> object is associated with a file or a filehandle, C<fileno> 801will return the underlying file descriptor. Once the C<close> method is 802called C<fileno> will return C<undef>. 803 804If the C<$z> object is associated with a buffer, this method will return 805C<undef>. 806 807=head2 close 808 809 $z->close() ; 810 close $z ; 811 812Flushes any pending compressed data and then closes the output file/buffer. 813 814For most versions of Perl this method will be automatically invoked if 815the IO::Compress::Deflate object is destroyed (either explicitly or by the 816variable with the reference to the object going out of scope). The 817exceptions are Perl versions 5.005 through 5.00504 and 5.8.0. In 818these cases, the C<close> method will be called automatically, but 819not until global destruction of all live objects when the program is 820terminating. 821 822Therefore, if you want your scripts to be able to run on all versions 823of Perl, you should call C<close> explicitly and not rely on automatic 824closing. 825 826Returns true on success, otherwise 0. 827 828If the C<AutoClose> option has been enabled when the IO::Compress::Deflate 829object was created, and the object is associated with a file, the 830underlying file will also be closed. 831 832=head2 newStream([OPTS]) 833 834Usage is 835 836 $z->newStream( [OPTS] ) 837 838Closes the current compressed data stream and starts a new one. 839 840OPTS consists of any of the options that are available when creating 841the C<$z> object. 842 843See the L</"Constructor Options"> section for more details. 844 845=head2 deflateParams 846 847Usage is 848 849 $z->deflateParams 850 851TODO 852 853=head1 Importing 854 855A number of symbolic constants are required by some methods in 856C<IO::Compress::Deflate>. None are imported by default. 857 858=over 5 859 860=item :all 861 862Imports C<deflate>, C<$DeflateError> and all symbolic 863constants that can be used by C<IO::Compress::Deflate>. Same as doing this 864 865 use IO::Compress::Deflate qw(deflate $DeflateError :constants) ; 866 867=item :constants 868 869Import all symbolic constants. Same as doing this 870 871 use IO::Compress::Deflate qw(:flush :level :strategy) ; 872 873=item :flush 874 875These symbolic constants are used by the C<flush> method. 876 877 Z_NO_FLUSH 878 Z_PARTIAL_FLUSH 879 Z_SYNC_FLUSH 880 Z_FULL_FLUSH 881 Z_FINISH 882 Z_BLOCK 883 884=item :level 885 886These symbolic constants are used by the C<Level> option in the constructor. 887 888 Z_NO_COMPRESSION 889 Z_BEST_SPEED 890 Z_BEST_COMPRESSION 891 Z_DEFAULT_COMPRESSION 892 893=item :strategy 894 895These symbolic constants are used by the C<Strategy> option in the constructor. 896 897 Z_FILTERED 898 Z_HUFFMAN_ONLY 899 Z_RLE 900 Z_FIXED 901 Z_DEFAULT_STRATEGY 902 903=back 904 905=head1 EXAMPLES 906 907=head2 Apache::GZip Revisited 908 909See L<IO::Compress::FAQ|IO::Compress::FAQ/"Apache::GZip Revisited"> 910 911=head2 Working with Net::FTP 912 913See L<IO::Compress::FAQ|IO::Compress::FAQ/"Compressed files and Net::FTP"> 914 915=head1 SUPPORT 916 917General feedback/questions/bug reports should be sent to 918L<https://github.com/pmqs/IO-Compress/issues> (preferred) or 919L<https://rt.cpan.org/Public/Dist/Display.html?Name=IO-Compress>. 920 921=head1 SEE ALSO 922 923L<Compress::Zlib>, L<IO::Compress::Gzip>, L<IO::Uncompress::Gunzip>, L<IO::Uncompress::Inflate>, L<IO::Compress::RawDeflate>, L<IO::Uncompress::RawInflate>, L<IO::Compress::Bzip2>, L<IO::Uncompress::Bunzip2>, L<IO::Compress::Lzma>, L<IO::Uncompress::UnLzma>, L<IO::Compress::Xz>, L<IO::Uncompress::UnXz>, L<IO::Compress::Lzip>, L<IO::Uncompress::UnLzip>, L<IO::Compress::Lzop>, L<IO::Uncompress::UnLzop>, L<IO::Compress::Lzf>, L<IO::Uncompress::UnLzf>, L<IO::Compress::Zstd>, L<IO::Uncompress::UnZstd>, L<IO::Uncompress::AnyInflate>, L<IO::Uncompress::AnyUncompress> 924 925L<IO::Compress::FAQ|IO::Compress::FAQ> 926 927L<File::GlobMapper|File::GlobMapper>, L<Archive::Zip|Archive::Zip>, 928L<Archive::Tar|Archive::Tar>, 929L<IO::Zlib|IO::Zlib> 930 931For RFC 1950, 1951 and 1952 see 932L<http://www.faqs.org/rfcs/rfc1950.html>, 933L<http://www.faqs.org/rfcs/rfc1951.html> and 934L<http://www.faqs.org/rfcs/rfc1952.html> 935 936The I<zlib> compression library was written by Jean-loup Gailly 937C<gzip@prep.ai.mit.edu> and Mark Adler C<madler@alumni.caltech.edu>. 938 939The primary site for the I<zlib> compression library is 940L<http://www.zlib.org>. 941 942The primary site for gzip is L<http://www.gzip.org>. 943 944=head1 AUTHOR 945 946This module was written by Paul Marquess, C<pmqs@cpan.org>. 947 948=head1 MODIFICATION HISTORY 949 950See the Changes file. 951 952=head1 COPYRIGHT AND LICENSE 953 954Copyright (c) 2005-2019 Paul Marquess. All rights reserved. 955 956This program is free software; you can redistribute it and/or 957modify it under the same terms as Perl itself. 958 959