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