IO::Compress::* 2.000_13
[p5sagit/p5-mst-13.2.git] / ext / Compress / IO / Zlib / lib / IO / Uncompress / Inflate.pm
CommitLineData
642e522c 1package IO::Uncompress::Inflate ;
2# for RFC1950
3
4use strict ;
5use warnings;
a02d0f6f 6use bytes;
642e522c 7
a02d0f6f 8use IO::Compress::Base::Common qw(:Status createSelfTiedObject);
9use IO::Compress::Zlib::Constants;
1a6a8453 10
11use IO::Uncompress::RawInflate ;
642e522c 12
13require Exporter ;
14our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $InflateError);
15
e7d45986 16$VERSION = '2.000_13';
642e522c 17$InflateError = '';
18
1a6a8453 19@ISA = qw( Exporter IO::Uncompress::RawInflate );
642e522c 20@EXPORT_OK = qw( $InflateError inflate ) ;
1a6a8453 21%EXPORT_TAGS = %IO::Uncompress::RawInflate::DEFLATE_CONSTANTS ;
642e522c 22push @{ $EXPORT_TAGS{all} }, @EXPORT_OK ;
23Exporter::export_ok_tags('all');
24
25
26sub new
27{
1a6a8453 28 my $class = shift ;
29 my $obj = createSelfTiedObject($class, \$InflateError);
30
31 $obj->_create(undef, 0, @_);
642e522c 32}
33
34sub inflate
35{
1a6a8453 36 my $obj = createSelfTiedObject(undef, \$InflateError);
37 return $obj->_inf(@_);
38}
39
40sub getExtraParams
41{
42 return ();
43}
44
45sub ckParams
46{
47 my $self = shift ;
48 my $got = shift ;
49
50 # gunzip always needs adler32
51 $got->value('ADLER32' => 1);
52
53 return 1;
54}
55
56sub ckMagic
57{
58 my $self = shift;
59
60 my $magic ;
61 $self->smartReadExact(\$magic, ZLIB_HEADER_SIZE);
62
63 *$self->{HeaderPending} = $magic ;
64
65 return $self->HeaderError("Header size is " .
66 ZLIB_HEADER_SIZE . " bytes")
67 if length $magic != ZLIB_HEADER_SIZE;
68
69 return $self->HeaderError("CRC mismatch.")
70 if ! isZlibMagic($magic) ;
71
72 *$self->{Type} = 'rfc1950';
73 return $magic;
74}
75
76sub readHeader
77{
78 my $self = shift;
79 my $magic = shift ;
80
81 return $self->_readDeflateHeader($magic) ;
82}
83
84sub chkTrailer
85{
86 my $self = shift;
87 my $trailer = shift;
88
89 my $ADLER32 = unpack("N", $trailer) ;
90 *$self->{Info}{ADLER32} = $ADLER32;
91 return $self->TrailerError("CRC mismatch")
92 if *$self->{Strict} && $ADLER32 != *$self->{Uncomp}->adler32() ;
93
a02d0f6f 94 return STATUS_OK;
1a6a8453 95}
96
97
98
99sub isZlibMagic
100{
101 my $buffer = shift ;
102 return 0 if length $buffer < ZLIB_HEADER_SIZE ;
103 my $hdr = unpack("n", $buffer) ;
104 return $hdr % 31 == 0 ;
642e522c 105}
106
1a6a8453 107sub bits
108{
109 my $data = shift ;
110 my $offset = shift ;
111 my $mask = shift ;
112
113 ($data >> $offset ) & $mask & 0xFF ;
114}
115
116
117sub _readDeflateHeader
118{
119 my ($self, $buffer) = @_ ;
120
121# if (! $buffer) {
122# $self->smartReadExact(\$buffer, ZLIB_HEADER_SIZE);
123#
124# *$self->{HeaderPending} = $buffer ;
125#
126# return $self->HeaderError("Header size is " .
127# ZLIB_HEADER_SIZE . " bytes")
128# if length $buffer != ZLIB_HEADER_SIZE;
129#
130# return $self->HeaderError("CRC mismatch.")
131# if ! isZlibMagic($buffer) ;
132# }
133
134 my ($CMF, $FLG) = unpack "C C", $buffer;
135 my $FDICT = bits($FLG, ZLIB_FLG_FDICT_OFFSET, ZLIB_FLG_FDICT_BITS ),
136
137 my $cm = bits($CMF, ZLIB_CMF_CM_OFFSET, ZLIB_CMF_CM_BITS) ;
138 $cm == ZLIB_CMF_CM_DEFLATED
139 or return $self->HeaderError("Not Deflate (CM is $cm)") ;
140
141 my $DICTID;
142 if ($FDICT) {
143 $self->smartReadExact(\$buffer, ZLIB_FDICT_SIZE)
144 or return $self->TruncatedHeader("FDICT");
145
146 $DICTID = unpack("N", $buffer) ;
147 }
148
149 *$self->{Type} = 'rfc1950';
150
151 return {
152 'Type' => 'rfc1950',
153 'FingerprintLength' => ZLIB_HEADER_SIZE,
154 'HeaderLength' => ZLIB_HEADER_SIZE,
155 'TrailerLength' => ZLIB_TRAILER_SIZE,
156 'Header' => $buffer,
157
158 CMF => $CMF ,
159 CM => bits($CMF, ZLIB_CMF_CM_OFFSET, ZLIB_CMF_CM_BITS ),
160 CINFO => bits($CMF, ZLIB_CMF_CINFO_OFFSET, ZLIB_CMF_CINFO_BITS ),
161 FLG => $FLG ,
162 FCHECK => bits($FLG, ZLIB_FLG_FCHECK_OFFSET, ZLIB_FLG_FCHECK_BITS),
163 FDICT => bits($FLG, ZLIB_FLG_FDICT_OFFSET, ZLIB_FLG_FDICT_BITS ),
164 FLEVEL => bits($FLG, ZLIB_FLG_LEVEL_OFFSET, ZLIB_FLG_LEVEL_BITS ),
165 DICTID => $DICTID ,
166
167 };
168}
169
170
171
172
642e522c 1731 ;
174
175__END__
176
177
178=head1 NAME
179
a02d0f6f 180
cb7abd7f 181
182IO::Uncompress::Inflate - Read RFC 1950 files/buffers
183
642e522c 184
a02d0f6f 185
642e522c 186=head1 SYNOPSIS
187
188 use IO::Uncompress::Inflate qw(inflate $InflateError) ;
189
190 my $status = inflate $input => $output [,OPTS]
191 or die "inflate failed: $InflateError\n";
192
193 my $z = new IO::Uncompress::Inflate $input [OPTS]
194 or die "inflate failed: $InflateError\n";
195
196 $status = $z->read($buffer)
197 $status = $z->read($buffer, $length)
198 $status = $z->read($buffer, $length, $offset)
199 $line = $z->getline()
200 $char = $z->getc()
201 $char = $z->ungetc()
a02d0f6f 202 $char = $z->opened()
203
642e522c 204 $status = $z->inflateSync()
a02d0f6f 205
e7d45986 206 $data = $z->trailingData()
207 $status = $z->nextStream()
642e522c 208 $data = $z->getHeaderInfo()
209 $z->tell()
210 $z->seek($position, $whence)
211 $z->binmode()
212 $z->fileno()
213 $z->eof()
214 $z->close()
215
216 $InflateError ;
217
218 # IO::File mode
219
220 <$z>
221 read($z, $buffer);
222 read($z, $buffer, $length);
223 read($z, $buffer, $length, $offset);
224 tell($z)
225 seek($z, $position, $whence)
226 binmode($z)
227 fileno($z)
228 eof($z)
229 close($z)
230
231
232=head1 DESCRIPTION
233
234
235
236B<WARNING -- This is a Beta release>.
237
238=over 5
239
240=item * DO NOT use in production code.
241
242=item * The documentation is incomplete in places.
243
244=item * Parts of the interface defined here are tentative.
245
246=item * Please report any problems you find.
247
248=back
249
250
251
252
253
1a6a8453 254This module provides a Perl interface that allows the reading of
642e522c 255files/buffers that conform to RFC 1950.
256
1a6a8453 257For writing RFC 1950 files/buffers, see the companion module IO::Compress::Deflate.
642e522c 258
259
260
cb7abd7f 261
262
263
642e522c 264=head1 Functional Interface
265
1a6a8453 266A top-level function, C<inflate>, is provided to carry out
267"one-shot" uncompression between buffers and/or files. For finer
268control over the uncompression process, see the L</"OO Interface">
269section.
642e522c 270
271 use IO::Uncompress::Inflate qw(inflate $InflateError) ;
272
273 inflate $input => $output [,OPTS]
274 or die "inflate failed: $InflateError\n";
275
1a6a8453 276
642e522c 277
278The functional interface needs Perl5.005 or better.
279
280
281=head2 inflate $input => $output [, OPTS]
282
1a6a8453 283
284C<inflate> expects at least two parameters, C<$input> and C<$output>.
642e522c 285
286=head3 The C<$input> parameter
287
288The parameter, C<$input>, is used to define the source of
289the compressed data.
290
291It can take one of the following forms:
292
293=over 5
294
295=item A filename
296
297If the C<$input> parameter is a simple scalar, it is assumed to be a
298filename. This file will be opened for reading and the input data
299will be read from it.
300
301=item A filehandle
302
303If the C<$input> parameter is a filehandle, the input data will be
304read from it.
305The string '-' can be used as an alias for standard input.
306
307=item A scalar reference
308
309If C<$input> is a scalar reference, the input data will be read
310from C<$$input>.
311
312=item An array reference
313
1a6a8453 314If C<$input> is an array reference, each element in the array must be a
315filename.
316
317The input data will be read from each file in turn.
318
642e522c 319The complete array will be walked to ensure that it only
1a6a8453 320contains valid filenames before any data is uncompressed.
321
322
642e522c 323
324=item An Input FileGlob string
325
326If C<$input> is a string that is delimited by the characters "<" and ">"
327C<inflate> will assume that it is an I<input fileglob string>. The
328input is the list of files that match the fileglob.
329
330If the fileglob does not match any files ...
331
332See L<File::GlobMapper|File::GlobMapper> for more details.
333
334
335=back
336
337If the C<$input> parameter is any other type, C<undef> will be returned.
338
339
340
341=head3 The C<$output> parameter
342
343The parameter C<$output> is used to control the destination of the
344uncompressed data. This parameter can take one of these forms.
345
346=over 5
347
348=item A filename
349
1a6a8453 350If the C<$output> parameter is a simple scalar, it is assumed to be a
351filename. This file will be opened for writing and the uncompressed
352data will be written to it.
642e522c 353
354=item A filehandle
355
1a6a8453 356If the C<$output> parameter is a filehandle, the uncompressed data
357will be written to it.
642e522c 358The string '-' can be used as an alias for standard output.
359
360
361=item A scalar reference
362
1a6a8453 363If C<$output> is a scalar reference, the uncompressed data will be
364stored in C<$$output>.
642e522c 365
642e522c 366
367
368=item An Array Reference
369
1a6a8453 370If C<$output> is an array reference, the uncompressed data will be
371pushed onto the array.
642e522c 372
373=item An Output FileGlob
374
375If C<$output> is a string that is delimited by the characters "<" and ">"
376C<inflate> will assume that it is an I<output fileglob string>. The
377output is the list of files that match the fileglob.
378
379When C<$output> is an fileglob string, C<$input> must also be a fileglob
380string. Anything else is an error.
381
382=back
383
384If the C<$output> parameter is any other type, C<undef> will be returned.
385
642e522c 386
642e522c 387
388=head2 Notes
389
c70c1701 390
391When C<$input> maps to multiple compressed files/buffers and C<$output> is
392a single file/buffer, after uncompression C<$output> will contain a
393concatenation of all the uncompressed data from each of the input
394files/buffers.
395
396
642e522c 397
398
399
400=head2 Optional Parameters
401
402Unless specified below, the optional parameters for C<inflate>,
403C<OPTS>, are the same as those used with the OO interface defined in the
404L</"Constructor Options"> section below.
405
406=over 5
407
e7d45986 408=item C<< AutoClose => 0|1 >>
642e522c 409
1a6a8453 410This option applies to any input or output data streams to
411C<inflate> that are filehandles.
642e522c 412
413If C<AutoClose> is specified, and the value is true, it will result in all
414input and/or output filehandles being closed once C<inflate> has
415completed.
416
417This parameter defaults to 0.
418
419
e7d45986 420=item C<< BinModeOut => 0|1 >>
1a6a8453 421
422When writing to a file or filehandle, set C<binmode> before writing to the
423file.
424
425Defaults to 0.
426
427
428
429
430
e7d45986 431=item C<< Append => 0|1 >>
642e522c 432
433TODO
434
e7d45986 435=item C<< MultiStream => 0|1 >>
1a6a8453 436
e7d45986 437If the input file/buffer contains multiple compressed data streams, this
438option will uncompress the whole lot as a single data stream.
1a6a8453 439
e7d45986 440Defaults to 0.
1a6a8453 441
642e522c 442
443
444=back
445
446
447
448
449=head2 Examples
450
451To read the contents of the file C<file1.txt.1950> and write the
452compressed data to the file C<file1.txt>.
453
454 use strict ;
455 use warnings ;
456 use IO::Uncompress::Inflate qw(inflate $InflateError) ;
457
458 my $input = "file1.txt.1950";
459 my $output = "file1.txt";
460 inflate $input => $output
461 or die "inflate failed: $InflateError\n";
462
463
464To read from an existing Perl filehandle, C<$input>, and write the
465uncompressed data to a buffer, C<$buffer>.
466
467 use strict ;
468 use warnings ;
469 use IO::Uncompress::Inflate qw(inflate $InflateError) ;
470 use IO::File ;
471
472 my $input = new IO::File "<file1.txt.1950"
473 or die "Cannot open 'file1.txt.1950': $!\n" ;
474 my $buffer ;
475 inflate $input => \$buffer
476 or die "inflate failed: $InflateError\n";
477
478To uncompress all files in the directory "/my/home" that match "*.txt.1950" and store the compressed data in the same directory
479
480 use strict ;
481 use warnings ;
482 use IO::Uncompress::Inflate qw(inflate $InflateError) ;
483
484 inflate '</my/home/*.txt.1950>' => '</my/home/#1.txt>'
485 or die "inflate failed: $InflateError\n";
486
487and if you want to compress each file one at a time, this will do the trick
488
489 use strict ;
490 use warnings ;
491 use IO::Uncompress::Inflate qw(inflate $InflateError) ;
492
493 for my $input ( glob "/my/home/*.txt.1950" )
494 {
495 my $output = $input;
496 $output =~ s/.1950// ;
497 inflate $input => $output
498 or die "Error compressing '$input': $InflateError\n";
499 }
500
501=head1 OO Interface
502
503=head2 Constructor
504
505The format of the constructor for IO::Uncompress::Inflate is shown below
506
507
508 my $z = new IO::Uncompress::Inflate $input [OPTS]
509 or die "IO::Uncompress::Inflate failed: $InflateError\n";
510
511Returns an C<IO::Uncompress::Inflate> object on success and undef on failure.
512The variable C<$InflateError> will contain an error message on failure.
513
1a6a8453 514If you are running Perl 5.005 or better the object, C<$z>, returned from
515IO::Uncompress::Inflate can be used exactly like an L<IO::File|IO::File> filehandle.
516This means that all normal input file operations can be carried out with
517C<$z>. For example, to read a line from a compressed file/buffer you can
518use either of these forms
642e522c 519
520 $line = $z->getline();
521 $line = <$z>;
522
523The mandatory parameter C<$input> is used to determine the source of the
524compressed data. This parameter can take one of three forms.
525
526=over 5
527
528=item A filename
529
530If the C<$input> parameter is a scalar, it is assumed to be a filename. This
531file will be opened for reading and the compressed data will be read from it.
532
533=item A filehandle
534
535If the C<$input> parameter is a filehandle, the compressed data will be
536read from it.
537The string '-' can be used as an alias for standard input.
538
539
540=item A scalar reference
541
542If C<$input> is a scalar reference, the compressed data will be read from
543C<$$output>.
544
545=back
546
547=head2 Constructor Options
548
549
550The option names defined below are case insensitive and can be optionally
551prefixed by a '-'. So all of the following are valid
552
553 -AutoClose
554 -autoclose
555 AUTOCLOSE
556 autoclose
557
558OPTS is a combination of the following options:
559
560=over 5
561
e7d45986 562=item C<< AutoClose => 0|1 >>
642e522c 563
564This option is only valid when the C<$input> parameter is a filehandle. If
565specified, and the value is true, it will result in the file being closed once
566either the C<close> method is called or the IO::Uncompress::Inflate object is
567destroyed.
568
569This parameter defaults to 0.
570
e7d45986 571=item C<< MultiStream => 0|1 >>
642e522c 572
573
574
575Allows multiple concatenated compressed streams to be treated as a single
576compressed stream. Decompression will stop once either the end of the
577file/buffer is reached, an error is encountered (premature eof, corrupt
578compressed data) or the end of a stream is not immediately followed by the
579start of another stream.
580
581This parameter defaults to 0.
582
583
e7d45986 584=item C<< Prime => $string >>
642e522c 585
586This option will uncompress the contents of C<$string> before processing the
587input file/buffer.
588
589This option can be useful when the compressed data is embedded in another
590file/data structure and it is not possible to work out where the compressed
1a6a8453 591data begins without having to read the first few bytes. If this is the
592case, the uncompression can be I<primed> with these bytes using this
593option.
642e522c 594
e7d45986 595=item C<< Transparent => 0|1 >>
642e522c 596
597If this option is set and the input file or buffer is not compressed data,
598the module will allow reading of it anyway.
599
600This option defaults to 1.
601
e7d45986 602=item C<< BlockSize => $num >>
642e522c 603
1a6a8453 604When reading the compressed input data, IO::Uncompress::Inflate will read it in
605blocks of C<$num> bytes.
642e522c 606
607This option defaults to 4096.
608
e7d45986 609=item C<< InputLength => $size >>
642e522c 610
1a6a8453 611When present this option will limit the number of compressed bytes read
612from the input file/buffer to C<$size>. This option can be used in the
613situation where there is useful data directly after the compressed data
614stream and you know beforehand the exact length of the compressed data
615stream.
642e522c 616
1a6a8453 617This option is mostly used when reading from a filehandle, in which case
618the file pointer will be left pointing to the first byte directly after the
642e522c 619compressed data stream.
620
621
622
623This option defaults to off.
624
e7d45986 625=item C<< Append => 0|1 >>
642e522c 626
627This option controls what the C<read> method does with uncompressed data.
628
1a6a8453 629If set to 1, all uncompressed data will be appended to the output parameter
630of the C<read> method.
642e522c 631
1a6a8453 632If set to 0, the contents of the output parameter of the C<read> method
633will be overwritten by the uncompressed data.
642e522c 634
635Defaults to 0.
636
e7d45986 637=item C<< Strict => 0|1 >>
642e522c 638
639
640
641This option controls whether the extra checks defined below are used when
1a6a8453 642carrying out the decompression. When Strict is on, the extra tests are
643carried out, when Strict is off they are not.
642e522c 644
645The default for this option is off.
646
647
648
649
650
651=over 5
652
653=item 1
654
655The ADLER32 checksum field must be present.
656
657=item 2
658
659The value of the ADLER32 field read must match the adler32 value of the
660uncompressed data actually contained in the file.
661
662=back
663
664
665
666
667
668
669
670
671
a02d0f6f 672
673
642e522c 674=back
675
676=head2 Examples
677
678TODO
679
680=head1 Methods
681
682=head2 read
683
684Usage is
685
686 $status = $z->read($buffer)
687
688Reads a block of compressed data (the size the the compressed block is
689determined by the C<Buffer> option in the constructor), uncompresses it and
1a6a8453 690writes any uncompressed data into C<$buffer>. If the C<Append> parameter is
691set in the constructor, the uncompressed data will be appended to the
692C<$buffer> parameter. Otherwise C<$buffer> will be overwritten.
642e522c 693
1a6a8453 694Returns the number of uncompressed bytes written to C<$buffer>, zero if eof
695or a negative number on error.
642e522c 696
697=head2 read
698
699Usage is
700
701 $status = $z->read($buffer, $length)
702 $status = $z->read($buffer, $length, $offset)
703
704 $status = read($z, $buffer, $length)
705 $status = read($z, $buffer, $length, $offset)
706
707Attempt to read C<$length> bytes of uncompressed data into C<$buffer>.
708
1a6a8453 709The main difference between this form of the C<read> method and the
710previous one, is that this one will attempt to return I<exactly> C<$length>
711bytes. The only circumstances that this function will not is if end-of-file
712or an IO error is encountered.
642e522c 713
1a6a8453 714Returns the number of uncompressed bytes written to C<$buffer>, zero if eof
715or a negative number on error.
642e522c 716
717
718=head2 getline
719
720Usage is
721
722 $line = $z->getline()
723 $line = <$z>
724
725Reads a single line.
726
727This method fully supports the use of of the variable C<$/>
728(or C<$INPUT_RECORD_SEPARATOR> or C<$RS> when C<English> is in use) to
729determine what constitutes an end of line. Both paragraph mode and file
730slurp mode are supported.
731
732
733=head2 getc
734
735Usage is
736
737 $char = $z->getc()
738
739Read a single character.
740
741=head2 ungetc
742
743Usage is
744
745 $char = $z->ungetc($string)
746
747
a02d0f6f 748
642e522c 749=head2 inflateSync
750
751Usage is
752
753 $status = $z->inflateSync()
754
755TODO
756
a02d0f6f 757
642e522c 758=head2 getHeaderInfo
759
760Usage is
761
1a6a8453 762 $hdr = $z->getHeaderInfo();
763 @hdrs = $z->getHeaderInfo();
642e522c 764
1a6a8453 765This method returns either a hash reference (in scalar context) or a list
766or hash references (in array context) that contains information about each
767of the header fields in the compressed data stream(s).
642e522c 768
769
770
771
772=head2 tell
773
774Usage is
775
776 $z->tell()
777 tell $z
778
779Returns the uncompressed file offset.
780
781=head2 eof
782
783Usage is
784
785 $z->eof();
786 eof($z);
787
788
789
790Returns true if the end of the compressed input stream has been reached.
791
792
793
794=head2 seek
795
796 $z->seek($position, $whence);
797 seek($z, $position, $whence);
798
799
800
801
802Provides a sub-set of the C<seek> functionality, with the restriction
803that it is only legal to seek forward in the input file/buffer.
804It is a fatal error to attempt to seek backward.
805
806
807
808The C<$whence> parameter takes one the usual values, namely SEEK_SET,
809SEEK_CUR or SEEK_END.
810
811Returns 1 on success, 0 on failure.
812
813=head2 binmode
814
815Usage is
816
817 $z->binmode
818 binmode $z ;
819
820This is a noop provided for completeness.
821
a02d0f6f 822=head2 opened
823
824 $z->opened()
825
826Returns true if the object currently refers to a opened file/buffer.
827
828=head2 autoflush
829
830 my $prev = $z->autoflush()
831 my $prev = $z->autoflush(EXPR)
832
833If the C<$z> object is associated with a file or a filehandle, this method
834returns the current autoflush setting for the underlying filehandle. If
835C<EXPR> is present, and is non-zero, it will enable flushing after every
836write/print operation.
837
838If C<$z> is associated with a buffer, this method has no effect and always
839returns C<undef>.
840
841B<Note> that the special variable C<$|> B<cannot> be used to set or
842retrieve the autoflush setting.
843
844=head2 input_line_number
845
846 $z->input_line_number()
847 $z->input_line_number(EXPR)
848
849
850
851Returns the current uncompressed line number. If C<EXPR> is present it has
852the effect of setting the line number. Note that setting the line number
853does not change the current position within the file/buffer being read.
854
855The contents of C<$/> are used to to determine what constitutes a line
856terminator.
857
858
859
642e522c 860=head2 fileno
861
862 $z->fileno()
863 fileno($z)
864
a02d0f6f 865If the C<$z> object is associated with a file or a filehandle, this method
866will return the underlying file descriptor.
642e522c 867
868If the C<$z> object is is associated with a buffer, this method will
869return undef.
870
871=head2 close
872
873 $z->close() ;
874 close $z ;
875
876
877
878Closes the output file/buffer.
879
880
881
882For most versions of Perl this method will be automatically invoked if
883the IO::Uncompress::Inflate object is destroyed (either explicitly or by the
884variable with the reference to the object going out of scope). The
885exceptions are Perl versions 5.005 through 5.00504 and 5.8.0. In
886these cases, the C<close> method will be called automatically, but
887not until global destruction of all live objects when the program is
888terminating.
889
890Therefore, if you want your scripts to be able to run on all versions
891of Perl, you should call C<close> explicitly and not rely on automatic
892closing.
893
894Returns true on success, otherwise 0.
895
896If the C<AutoClose> option has been enabled when the IO::Uncompress::Inflate
897object was created, and the object is associated with a file, the
898underlying file will also be closed.
899
900
901
902
e7d45986 903=head2 nextStream
904
905Usage is
906
907 my $status = $z->nextStream();
908
909Skips to the next compressed data stream in the input file/buffer. If a new
910compressed data stream is found, the eof marker will be cleared, C<$.> will
911be reset to 0.
912
913Returns 1 if a new stream was found, 0 if none was found, and -1 if an
914error was encountered.
915
916=head2 trailingData
917
918Usage is
919
920 my $data = $z->trailingData();
921
922Returns any data that
923
642e522c 924=head1 Importing
925
926No symbolic constants are required by this IO::Uncompress::Inflate at present.
927
928=over 5
929
930=item :all
931
932Imports C<inflate> and C<$InflateError>.
933Same as doing this
934
935 use IO::Uncompress::Inflate qw(inflate $InflateError) ;
936
937=back
938
939=head1 EXAMPLES
940
941
942
943
944=head1 SEE ALSO
945
a02d0f6f 946L<Compress::Zlib>, L<IO::Compress::Gzip>, L<IO::Uncompress::Gunzip>, L<IO::Compress::Deflate>, L<IO::Compress::RawDeflate>, 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>
642e522c 947
948L<Compress::Zlib::FAQ|Compress::Zlib::FAQ>
949
a02d0f6f 950L<File::GlobMapper|File::GlobMapper>, L<Archive::Zip|Archive::Zip>,
951L<Archive::Tar|Archive::Tar>,
642e522c 952L<IO::Zlib|IO::Zlib>
953
a02d0f6f 954
642e522c 955For RFC 1950, 1951 and 1952 see
956F<http://www.faqs.org/rfcs/rfc1950.html>,
957F<http://www.faqs.org/rfcs/rfc1951.html> and
958F<http://www.faqs.org/rfcs/rfc1952.html>
959
a02d0f6f 960The I<zlib> compression library was written by Jean-loup Gailly
961F<gzip@prep.ai.mit.edu> and Mark Adler F<madler@alumni.caltech.edu>.
962
963The primary site for the I<zlib> compression library is
964F<http://www.zlib.org>.
965
966The primary site for gzip is F<http://www.gzip.org>.
967
968
969
970
642e522c 971=head1 AUTHOR
972
cb7abd7f 973This module was written by Paul Marquess, F<pmqs@cpan.org>.
642e522c 974
642e522c 975
642e522c 976
977=head1 MODIFICATION HISTORY
978
979See the Changes file.
980
981=head1 COPYRIGHT AND LICENSE
642e522c 982
1a6a8453 983Copyright (c) 2005-2006 Paul Marquess. All rights reserved.
a02d0f6f 984
642e522c 985This program is free software; you can redistribute it and/or
986modify it under the same terms as Perl itself.
987