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