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