1 package IO::Uncompress::RawInflate ;
8 use Compress::Raw::Zlib 2.069 ;
9 use IO::Compress::Base::Common 2.069 qw(:Status );
11 use IO::Uncompress::Base 2.069 ;
12 use IO::Uncompress::Adapter::Inflate 2.069 ;
15 our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, %DEFLATE_CONSTANTS, $RawInflateError);
18 $RawInflateError = '';
20 @ISA = qw( Exporter IO::Uncompress::Base );
21 @EXPORT_OK = qw( $RawInflateError rawinflate ) ;
22 %DEFLATE_CONSTANTS = ();
23 %EXPORT_TAGS = %IO::Uncompress::Base::EXPORT_TAGS ;
24 push @{ $EXPORT_TAGS{all} }, @EXPORT_OK ;
25 Exporter::export_ok_tags('all');
28 # # Execute at runtime
30 # for my $module (qw(Compress::Raw::Zlib IO::Compress::Base::Common IO::Uncompress::Base IO::Uncompress::Adapter::Inflate))
32 # my $ver = ${ $module . "::VERSION"} ;
34 # $bad{$module} = $ver
35 # if $ver ne $VERSION;
40 # my $string = join "\n", map { "$_ $bad{$_}" } keys %bad;
41 # die caller(0)[0] . "needs version $VERSION mismatch\n$string\n";
48 my $obj = IO::Compress::Base::Common::createSelfTiedObject($class, \$RawInflateError);
49 $obj->_create(undef, 0, @_);
54 my $obj = IO::Compress::Base::Common::createSelfTiedObject(undef, \$RawInflateError);
55 return $obj->_inf(@_);
76 my ($obj, $errstr, $errno) = IO::Uncompress::Adapter::Inflate::mkUncompObject(
77 $got->getValue('crc32'),
78 $got->getValue('adler32'),
79 $got->getValue('scan'),
82 return $self->saveErrorString(undef, $errstr, $errno)
85 *$self->{Uncomp} = $obj;
87 my $magic = $self->ckMagic()
90 *$self->{Info} = $self->readHeader($magic)
102 return $self->_isRaw() ;
112 'FingerprintLength' => 0,
114 'TrailerLength' => 0,
128 my $got = $self->_isRawx(@_);
131 *$self->{Pending} = *$self->{HeaderPending} ;
134 $self->pushBack(*$self->{HeaderPending});
135 *$self->{Uncomp}->reset();
137 *$self->{HeaderPending} = '';
147 $magic = '' unless defined $magic ;
151 $self->smartRead(\$buffer, *$self->{BlockSize}) >= 0
152 or return $self->saveErrorString(undef, "No data to read");
154 my $temp_buf = $magic . $buffer ;
155 *$self->{HeaderPending} = $temp_buf ;
157 my $status = *$self->{Uncomp}->uncompr(\$temp_buf, \$buffer, $self->smartEof()) ;
159 return $self->saveErrorString(undef, *$self->{Uncomp}{Error}, STATUS_ERROR)
160 if $status == STATUS_ERROR;
162 $self->pushBack($temp_buf) ;
164 return $self->saveErrorString(undef, "unexpected end of file", STATUS_ERROR)
165 if $self->smartEof() && $status != STATUS_ENDSTREAM;
167 #my $buf_len = *$self->{Uncomp}->uncompressedBytes();
168 my $buf_len = length $buffer;
170 if ($status == STATUS_ENDSTREAM) {
171 if (*$self->{MultiStream}
172 && (length $temp_buf || ! $self->smartEof())){
173 *$self->{NewStream} = 1 ;
174 *$self->{EndStream} = 0 ;
177 *$self->{EndStream} = 1 ;
180 *$self->{HeaderPending} = $buffer ;
181 *$self->{InflatedBytesRead} = $buf_len ;
182 *$self->{TotalInflatedBytesRead} += $buf_len ;
183 *$self->{Type} = 'rfc1951';
185 $self->saveStatus(STATUS_OK);
190 'TrailerLength' => 0,
200 # inflateSync is a no-op in Plain mode
204 return 0 if *$self->{Closed} ;
205 #return G_EOF if !length *$self->{Pending} && *$self->{EndStream} ;
206 return 0 if ! length *$self->{Pending} && *$self->{EndStream} ;
209 *$self->{Strict} = 0 ;
216 if (length *$self->{Pending} )
218 $temp_buf = *$self->{Pending} ;
219 *$self->{Pending} = '';
223 $status = $self->smartRead(\$temp_buf, *$self->{BlockSize}) ;
224 return $self->saveErrorString(0, "Error Reading Data")
228 *$self->{EndStream} = 1 ;
229 return $self->saveErrorString(0, "unexpected end of file", STATUS_ERROR);
233 $status = *$self->{Uncomp}->sync($temp_buf) ;
235 if ($status == STATUS_OK)
237 *$self->{Pending} .= $temp_buf ;
241 last unless $status == STATUS_ERROR ;
252 # my $end_offset = 0;
254 # $status = $self->scan()
255 # #or return $self->saveErrorString(undef, "Error Scanning: $$error_ref", $self->errorNo) ;
256 # or return $self->saveErrorString(G_ERR, "Error Scanning: $status")
258 # $status = $self->zap($end_offset)
259 # or return $self->saveErrorString(G_ERR, "Error Zapping: $status");
260 # #or return $self->saveErrorString(undef, "Error Zapping: $$error_ref", $self->errorNo) ;
262 # #(*$obj->{Deflate}, $status) = $inf->createDeflate();
264 ## *$obj->{Header} = *$inf->{Info}{Header};
265 ## *$obj->{UnCompSize_32bit} =
266 ## *$obj->{BytesWritten} = *$inf->{UnCompSize_32bit} ;
267 ## *$obj->{CompSize_32bit} = *$inf->{CompSize_32bit} ;
270 ## if ( $outType eq 'buffer')
271 ## { substr( ${ *$self->{Buffer} }, $end_offset) = '' }
272 ## elsif ($outType eq 'handle' || $outType eq 'filename') {
273 ## *$self->{FH} = *$inf->{FH} ;
274 ## delete *$inf->{FH};
275 ## *$obj->{FH}->flush() ;
276 ## *$obj->{Handle} = 1 if $outType eq 'handle';
278 ## #seek(*$obj->{FH}, $end_offset, SEEK_SET)
279 ## *$obj->{FH}->seek($end_offset, SEEK_SET)
280 ## or return $obj->saveErrorString(undef, $!, $!) ;
289 return 1 if *$self->{Closed} ;
290 return 1 if !length *$self->{Pending} && *$self->{EndStream} ;
295 $len = $self->_raw_read(\$buffer, 1)
296 while ! *$self->{EndStream} && $len >= 0 ;
298 #return $len if $len < 0 ? $len : 0 ;
299 return $len < 0 ? 0 : 1 ;
306 my $headerLength = *$self->{Info}{HeaderLength};
307 my $block_offset = $headerLength + *$self->{Uncomp}->getLastBlockOffset();
308 $_[0] = $headerLength + *$self->{Uncomp}->getEndOffset();
309 #printf "# End $_[0], headerlen $headerLength \n";;
310 #printf "# block_offset $block_offset %x\n", $block_offset;
312 ( $self->smartSeek($block_offset) &&
313 $self->smartRead(\$byte, 1) )
314 or return $self->saveErrorString(0, $!, $!);
316 #printf "#byte is %x\n", unpack('C*',$byte);
317 *$self->{Uncomp}->resetLastBlockByte($byte);
318 #printf "#to byte is %x\n", unpack('C*',$byte);
320 ( $self->smartSeek($block_offset) &&
321 $self->smartWrite($byte) )
322 or return $self->saveErrorString(0, $!, $!);
324 #$self->smartSeek($end_offset, 1);
332 my ($def, $status) = *$self->{Uncomp}->createDeflateStream(
334 -WindowBits => - MAX_WBITS,
335 -CRC32 => *$self->{Params}->getValue('crc32'),
336 -ADLER32 => *$self->{Params}->getValue('adler32'),
339 return wantarray ? ($status, $def) : $def ;
350 IO::Uncompress::RawInflate - Read RFC 1951 files/buffers
354 use IO::Uncompress::RawInflate qw(rawinflate $RawInflateError) ;
356 my $status = rawinflate $input => $output [,OPTS]
357 or die "rawinflate failed: $RawInflateError\n";
359 my $z = new IO::Uncompress::RawInflate $input [OPTS]
360 or die "rawinflate failed: $RawInflateError\n";
362 $status = $z->read($buffer)
363 $status = $z->read($buffer, $length)
364 $status = $z->read($buffer, $length, $offset)
365 $line = $z->getline()
370 $status = $z->inflateSync()
372 $data = $z->trailingData()
373 $status = $z->nextStream()
374 $data = $z->getHeaderInfo()
376 $z->seek($position, $whence)
388 read($z, $buffer, $length);
389 read($z, $buffer, $length, $offset);
391 seek($z, $position, $whence)
399 This module provides a Perl interface that allows the reading of
400 files/buffers that conform to RFC 1951.
402 For writing RFC 1951 files/buffers, see the companion module IO::Compress::RawDeflate.
404 =head1 Functional Interface
406 A top-level function, C<rawinflate>, is provided to carry out
407 "one-shot" uncompression between buffers and/or files. For finer
408 control over the uncompression process, see the L</"OO Interface">
411 use IO::Uncompress::RawInflate qw(rawinflate $RawInflateError) ;
413 rawinflate $input_filename_or_reference => $output_filename_or_reference [,OPTS]
414 or die "rawinflate failed: $RawInflateError\n";
416 The functional interface needs Perl5.005 or better.
418 =head2 rawinflate $input_filename_or_reference => $output_filename_or_reference [, OPTS]
420 C<rawinflate> expects at least two parameters,
421 C<$input_filename_or_reference> and C<$output_filename_or_reference>.
423 =head3 The C<$input_filename_or_reference> parameter
425 The parameter, C<$input_filename_or_reference>, is used to define the
426 source of the compressed data.
428 It can take one of the following forms:
434 If the <$input_filename_or_reference> parameter is a simple scalar, it is
435 assumed to be a filename. This file will be opened for reading and the
436 input data will be read from it.
440 If the C<$input_filename_or_reference> parameter is a filehandle, the input
441 data will be read from it. The string '-' can be used as an alias for
444 =item A scalar reference
446 If C<$input_filename_or_reference> is a scalar reference, the input data
447 will be read from C<$$input_filename_or_reference>.
449 =item An array reference
451 If C<$input_filename_or_reference> is an array reference, each element in
452 the array must be a filename.
454 The input data will be read from each file in turn.
456 The complete array will be walked to ensure that it only
457 contains valid filenames before any data is uncompressed.
459 =item An Input FileGlob string
461 If C<$input_filename_or_reference> is a string that is delimited by the
462 characters "<" and ">" C<rawinflate> will assume that it is an
463 I<input fileglob string>. The input is the list of files that match the
466 See L<File::GlobMapper|File::GlobMapper> for more details.
470 If the C<$input_filename_or_reference> parameter is any other type,
471 C<undef> will be returned.
473 =head3 The C<$output_filename_or_reference> parameter
475 The parameter C<$output_filename_or_reference> is used to control the
476 destination of the uncompressed data. This parameter can take one of
483 If the C<$output_filename_or_reference> parameter is a simple scalar, it is
484 assumed to be a filename. This file will be opened for writing and the
485 uncompressed data will be written to it.
489 If the C<$output_filename_or_reference> parameter is a filehandle, the
490 uncompressed data will be written to it. The string '-' can be used as
491 an alias for standard output.
493 =item A scalar reference
495 If C<$output_filename_or_reference> is a scalar reference, the
496 uncompressed data will be stored in C<$$output_filename_or_reference>.
498 =item An Array Reference
500 If C<$output_filename_or_reference> is an array reference,
501 the uncompressed data will be pushed onto the array.
503 =item An Output FileGlob
505 If C<$output_filename_or_reference> is a string that is delimited by the
506 characters "<" and ">" C<rawinflate> will assume that it is an
507 I<output fileglob string>. The output is the list of files that match the
510 When C<$output_filename_or_reference> is an fileglob string,
511 C<$input_filename_or_reference> must also be a fileglob string. Anything
514 See L<File::GlobMapper|File::GlobMapper> for more details.
518 If the C<$output_filename_or_reference> parameter is any other type,
519 C<undef> will be returned.
523 When C<$input_filename_or_reference> maps to multiple compressed
524 files/buffers and C<$output_filename_or_reference> is
525 a single file/buffer, after uncompression C<$output_filename_or_reference> will contain a
526 concatenation of all the uncompressed data from each of the input
529 =head2 Optional Parameters
531 Unless specified below, the optional parameters for C<rawinflate>,
532 C<OPTS>, are the same as those used with the OO interface defined in the
533 L</"Constructor Options"> section below.
537 =item C<< AutoClose => 0|1 >>
539 This option applies to any input or output data streams to
540 C<rawinflate> that are filehandles.
542 If C<AutoClose> is specified, and the value is true, it will result in all
543 input and/or output filehandles being closed once C<rawinflate> has
546 This parameter defaults to 0.
548 =item C<< BinModeOut => 0|1 >>
550 When writing to a file or filehandle, set C<binmode> before writing to the
555 =item C<< Append => 0|1 >>
557 The behaviour of this option is dependent on the type of output data
564 If C<Append> is enabled, all uncompressed data will be append to the end of
565 the output buffer. Otherwise the output buffer will be cleared before any
566 uncompressed data is written to it.
570 If C<Append> is enabled, the file will be opened in append mode. Otherwise
571 the contents of the file, if any, will be truncated before any uncompressed
572 data is written to it.
576 If C<Append> is enabled, the filehandle will be positioned to the end of
577 the file via a call to C<seek> before any uncompressed data is
578 written to it. Otherwise the file pointer will not be moved.
582 When C<Append> is specified, and set to true, it will I<append> all uncompressed
583 data to the output data stream.
585 So when the output is a filehandle it will carry out a seek to the eof
586 before writing any uncompressed data. If the output is a filename, it will be opened for
587 appending. If the output is a buffer, all uncompressed data will be
588 appended to the existing buffer.
590 Conversely when C<Append> is not specified, or it is present and is set to
591 false, it will operate as follows.
593 When the output is a filename, it will truncate the contents of the file
594 before writing any uncompressed data. If the output is a filehandle
595 its position will not be changed. If the output is a buffer, it will be
596 wiped before any uncompressed data is output.
600 =item C<< MultiStream => 0|1 >>
602 This option is a no-op.
604 =item C<< TrailingData => $scalar >>
606 Returns the data, if any, that is present immediately after the compressed
607 data stream once uncompression is complete.
609 This option can be used when there is useful information immediately
610 following the compressed data stream, and you don't know the length of the
611 compressed data stream.
613 If the input is a buffer, C<trailingData> will return everything from the
614 end of the compressed data stream to the end of the buffer.
616 If the input is a filehandle, C<trailingData> will return the data that is
617 left in the filehandle input buffer once the end of the compressed data
618 stream has been reached. You can then use the filehandle to read the rest
621 Don't bother using C<trailingData> if the input is a filename.
623 If you know the length of the compressed data stream before you start
624 uncompressing, you can avoid having to use C<trailingData> by setting the
625 C<InputLength> option.
631 To read the contents of the file C<file1.txt.1951> and write the
632 uncompressed data to the file C<file1.txt>.
636 use IO::Uncompress::RawInflate qw(rawinflate $RawInflateError) ;
638 my $input = "file1.txt.1951";
639 my $output = "file1.txt";
640 rawinflate $input => $output
641 or die "rawinflate failed: $RawInflateError\n";
643 To read from an existing Perl filehandle, C<$input>, and write the
644 uncompressed data to a buffer, C<$buffer>.
648 use IO::Uncompress::RawInflate qw(rawinflate $RawInflateError) ;
651 my $input = new IO::File "<file1.txt.1951"
652 or die "Cannot open 'file1.txt.1951': $!\n" ;
654 rawinflate $input => \$buffer
655 or die "rawinflate failed: $RawInflateError\n";
657 To uncompress all files in the directory "/my/home" that match "*.txt.1951" and store the compressed data in the same directory
661 use IO::Uncompress::RawInflate qw(rawinflate $RawInflateError) ;
663 rawinflate '</my/home/*.txt.1951>' => '</my/home/#1.txt>'
664 or die "rawinflate failed: $RawInflateError\n";
666 and if you want to compress each file one at a time, this will do the trick
670 use IO::Uncompress::RawInflate qw(rawinflate $RawInflateError) ;
672 for my $input ( glob "/my/home/*.txt.1951" )
675 $output =~ s/.1951// ;
676 rawinflate $input => $output
677 or die "Error compressing '$input': $RawInflateError\n";
684 The format of the constructor for IO::Uncompress::RawInflate is shown below
686 my $z = new IO::Uncompress::RawInflate $input [OPTS]
687 or die "IO::Uncompress::RawInflate failed: $RawInflateError\n";
689 Returns an C<IO::Uncompress::RawInflate> object on success and undef on failure.
690 The variable C<$RawInflateError> will contain an error message on failure.
692 If you are running Perl 5.005 or better the object, C<$z>, returned from
693 IO::Uncompress::RawInflate can be used exactly like an L<IO::File|IO::File> filehandle.
694 This means that all normal input file operations can be carried out with
695 C<$z>. For example, to read a line from a compressed file/buffer you can
696 use either of these forms
698 $line = $z->getline();
701 The mandatory parameter C<$input> is used to determine the source of the
702 compressed data. This parameter can take one of three forms.
708 If the C<$input> parameter is a scalar, it is assumed to be a filename. This
709 file will be opened for reading and the compressed data will be read from it.
713 If the C<$input> parameter is a filehandle, the compressed data will be
715 The string '-' can be used as an alias for standard input.
717 =item A scalar reference
719 If C<$input> is a scalar reference, the compressed data will be read from
724 =head2 Constructor Options
726 The option names defined below are case insensitive and can be optionally
727 prefixed by a '-'. So all of the following are valid
734 OPTS is a combination of the following options:
738 =item C<< AutoClose => 0|1 >>
740 This option is only valid when the C<$input> parameter is a filehandle. If
741 specified, and the value is true, it will result in the file being closed once
742 either the C<close> method is called or the IO::Uncompress::RawInflate object is
745 This parameter defaults to 0.
747 =item C<< MultiStream => 0|1 >>
749 Allows multiple concatenated compressed streams to be treated as a single
750 compressed stream. Decompression will stop once either the end of the
751 file/buffer is reached, an error is encountered (premature eof, corrupt
752 compressed data) or the end of a stream is not immediately followed by the
753 start of another stream.
755 This parameter defaults to 0.
757 =item C<< Prime => $string >>
759 This option will uncompress the contents of C<$string> before processing the
762 This option can be useful when the compressed data is embedded in another
763 file/data structure and it is not possible to work out where the compressed
764 data begins without having to read the first few bytes. If this is the
765 case, the uncompression can be I<primed> with these bytes using this
768 =item C<< Transparent => 0|1 >>
770 If this option is set and the input file/buffer is not compressed data,
771 the module will allow reading of it anyway.
773 In addition, if the input file/buffer does contain compressed data and
774 there is non-compressed data immediately following it, setting this option
775 will make this module treat the whole file/buffer as a single data stream.
777 This option defaults to 1.
779 =item C<< BlockSize => $num >>
781 When reading the compressed input data, IO::Uncompress::RawInflate will read it in
782 blocks of C<$num> bytes.
784 This option defaults to 4096.
786 =item C<< InputLength => $size >>
788 When present this option will limit the number of compressed bytes read
789 from the input file/buffer to C<$size>. This option can be used in the
790 situation where there is useful data directly after the compressed data
791 stream and you know beforehand the exact length of the compressed data
794 This option is mostly used when reading from a filehandle, in which case
795 the file pointer will be left pointing to the first byte directly after the
796 compressed data stream.
798 This option defaults to off.
800 =item C<< Append => 0|1 >>
802 This option controls what the C<read> method does with uncompressed data.
804 If set to 1, all uncompressed data will be appended to the output parameter
805 of the C<read> method.
807 If set to 0, the contents of the output parameter of the C<read> method
808 will be overwritten by the uncompressed data.
812 =item C<< Strict => 0|1 >>
814 This option is a no-op.
828 $status = $z->read($buffer)
830 Reads a block of compressed data (the size of the compressed block is
831 determined by the C<Buffer> option in the constructor), uncompresses it and
832 writes any uncompressed data into C<$buffer>. If the C<Append> parameter is
833 set in the constructor, the uncompressed data will be appended to the
834 C<$buffer> parameter. Otherwise C<$buffer> will be overwritten.
836 Returns the number of uncompressed bytes written to C<$buffer>, zero if eof
837 or a negative number on error.
843 $status = $z->read($buffer, $length)
844 $status = $z->read($buffer, $length, $offset)
846 $status = read($z, $buffer, $length)
847 $status = read($z, $buffer, $length, $offset)
849 Attempt to read C<$length> bytes of uncompressed data into C<$buffer>.
851 The main difference between this form of the C<read> method and the
852 previous one, is that this one will attempt to return I<exactly> C<$length>
853 bytes. The only circumstances that this function will not is if end-of-file
854 or an IO error is encountered.
856 Returns the number of uncompressed bytes written to C<$buffer>, zero if eof
857 or a negative number on error.
863 $line = $z->getline()
868 This method fully supports the use of the variable C<$/> (or
869 C<$INPUT_RECORD_SEPARATOR> or C<$RS> when C<English> is in use) to
870 determine what constitutes an end of line. Paragraph mode, record mode and
871 file slurp mode are all supported.
879 Read a single character.
885 $char = $z->ungetc($string)
891 $status = $z->inflateSync()
899 $hdr = $z->getHeaderInfo();
900 @hdrs = $z->getHeaderInfo();
902 This method returns either a hash reference (in scalar context) or a list
903 or hash references (in array context) that contains information about each
904 of the header fields in the compressed data stream(s).
913 Returns the uncompressed file offset.
922 Returns true if the end of the compressed input stream has been reached.
926 $z->seek($position, $whence);
927 seek($z, $position, $whence);
929 Provides a sub-set of the C<seek> functionality, with the restriction
930 that it is only legal to seek forward in the input file/buffer.
931 It is a fatal error to attempt to seek backward.
933 Note that the implementation of C<seek> in this module does not provide
934 true random access to a compressed file/buffer. It works by uncompressing
935 data from the current offset in the file/buffer until it reaches the
936 uncompressed offset specified in the parameters to C<seek>. For very small
937 files this may be acceptable behaviour. For large files it may cause an
940 The C<$whence> parameter takes one the usual values, namely SEEK_SET,
941 SEEK_CUR or SEEK_END.
943 Returns 1 on success, 0 on failure.
952 This is a noop provided for completeness.
958 Returns true if the object currently refers to a opened file/buffer.
962 my $prev = $z->autoflush()
963 my $prev = $z->autoflush(EXPR)
965 If the C<$z> object is associated with a file or a filehandle, this method
966 returns the current autoflush setting for the underlying filehandle. If
967 C<EXPR> is present, and is non-zero, it will enable flushing after every
968 write/print operation.
970 If C<$z> is associated with a buffer, this method has no effect and always
973 B<Note> that the special variable C<$|> B<cannot> be used to set or
974 retrieve the autoflush setting.
976 =head2 input_line_number
978 $z->input_line_number()
979 $z->input_line_number(EXPR)
981 Returns the current uncompressed line number. If C<EXPR> is present it has
982 the effect of setting the line number. Note that setting the line number
983 does not change the current position within the file/buffer being read.
985 The contents of C<$/> are used to determine what constitutes a line
993 If the C<$z> object is associated with a file or a filehandle, C<fileno>
994 will return the underlying file descriptor. Once the C<close> method is
995 called C<fileno> will return C<undef>.
997 If the C<$z> object is associated with a buffer, this method will return
1005 Closes the output file/buffer.
1007 For most versions of Perl this method will be automatically invoked if
1008 the IO::Uncompress::RawInflate object is destroyed (either explicitly or by the
1009 variable with the reference to the object going out of scope). The
1010 exceptions are Perl versions 5.005 through 5.00504 and 5.8.0. In
1011 these cases, the C<close> method will be called automatically, but
1012 not until global destruction of all live objects when the program is
1015 Therefore, if you want your scripts to be able to run on all versions
1016 of Perl, you should call C<close> explicitly and not rely on automatic
1019 Returns true on success, otherwise 0.
1021 If the C<AutoClose> option has been enabled when the IO::Uncompress::RawInflate
1022 object was created, and the object is associated with a file, the
1023 underlying file will also be closed.
1029 my $status = $z->nextStream();
1031 Skips to the next compressed data stream in the input file/buffer. If a new
1032 compressed data stream is found, the eof marker will be cleared and C<$.>
1035 Returns 1 if a new stream was found, 0 if none was found, and -1 if an
1036 error was encountered.
1042 my $data = $z->trailingData();
1044 Returns the data, if any, that is present immediately after the compressed
1045 data stream once uncompression is complete. It only makes sense to call
1046 this method once the end of the compressed data stream has been
1049 This option can be used when there is useful information immediately
1050 following the compressed data stream, and you don't know the length of the
1051 compressed data stream.
1053 If the input is a buffer, C<trailingData> will return everything from the
1054 end of the compressed data stream to the end of the buffer.
1056 If the input is a filehandle, C<trailingData> will return the data that is
1057 left in the filehandle input buffer once the end of the compressed data
1058 stream has been reached. You can then use the filehandle to read the rest
1061 Don't bother using C<trailingData> if the input is a filename.
1063 If you know the length of the compressed data stream before you start
1064 uncompressing, you can avoid having to use C<trailingData> by setting the
1065 C<InputLength> option in the constructor.
1069 No symbolic constants are required by this IO::Uncompress::RawInflate at present.
1075 Imports C<rawinflate> and C<$RawInflateError>.
1078 use IO::Uncompress::RawInflate qw(rawinflate $RawInflateError) ;
1084 =head2 Working with Net::FTP
1086 See L<IO::Compress::FAQ|IO::Compress::FAQ/"Compressed files and Net::FTP">
1090 L<Compress::Zlib>, L<IO::Compress::Gzip>, L<IO::Uncompress::Gunzip>, L<IO::Compress::Deflate>, L<IO::Uncompress::Inflate>, L<IO::Compress::RawDeflate>, L<IO::Compress::Bzip2>, L<IO::Uncompress::Bunzip2>, L<IO::Compress::Lzma>, L<IO::Uncompress::UnLzma>, L<IO::Compress::Xz>, L<IO::Uncompress::UnXz>, L<IO::Compress::Lzop>, L<IO::Uncompress::UnLzop>, L<IO::Compress::Lzf>, L<IO::Uncompress::UnLzf>, L<IO::Uncompress::AnyInflate>, L<IO::Uncompress::AnyUncompress>
1092 L<IO::Compress::FAQ|IO::Compress::FAQ>
1094 L<File::GlobMapper|File::GlobMapper>, L<Archive::Zip|Archive::Zip>,
1095 L<Archive::Tar|Archive::Tar>,
1096 L<IO::Zlib|IO::Zlib>
1098 For RFC 1950, 1951 and 1952 see
1099 F<http://www.faqs.org/rfcs/rfc1950.html>,
1100 F<http://www.faqs.org/rfcs/rfc1951.html> and
1101 F<http://www.faqs.org/rfcs/rfc1952.html>
1103 The I<zlib> compression library was written by Jean-loup Gailly
1104 F<gzip@prep.ai.mit.edu> and Mark Adler F<madler@alumni.caltech.edu>.
1106 The primary site for the I<zlib> compression library is
1107 F<http://www.zlib.org>.
1109 The primary site for gzip is F<http://www.gzip.org>.
1113 This module was written by Paul Marquess, F<pmqs@cpan.org>.
1115 =head1 MODIFICATION HISTORY
1117 See the Changes file.
1119 =head1 COPYRIGHT AND LICENSE
1121 Copyright (c) 2005-2015 Paul Marquess. All rights reserved.
1123 This program is free software; you can redistribute it and/or
1124 modify it under the same terms as Perl itself.