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