2 package IO::Uncompress::Base ;
8 our (@ISA, $VERSION, @EXPORT_OK, %EXPORT_TAGS);
9 #@ISA = qw(Exporter IO::File);
13 $VERSION = '2.000_12';
15 use constant G_EOF => 0 ;
16 use constant G_ERR => -1 ;
18 use IO::Compress::Base::Common;
19 #use Parse::Parameters ;
23 use Scalar::Util qw(readonly);
24 use List::Util qw(min);
28 push @{ $EXPORT_TAGS{all} }, @EXPORT_OK ;
29 #Exporter::export_ok_tags('all') ;
42 if (defined *$self->{InputLength} &&
43 *$self->{InputLengthRemaining} <= 0) {
47 if ( length *$self->{Prime} ) {
48 #$$out = substr(*$self->{Prime}, 0, $size, '') ;
49 $$out = substr(*$self->{Prime}, 0, $size) ;
50 substr(*$self->{Prime}, 0, $size) = '' ;
51 if (length $$out == $size || defined *$self->{InputLength}) {
52 *$self->{InputLengthRemaining} -= length $$out;
55 $offset = length $$out ;
58 my $get_size = $size - $offset ;
60 if ( defined *$self->{InputLength} ) {
61 $get_size = min($get_size, *$self->{InputLengthRemaining});
64 if (defined *$self->{FH})
65 { *$self->{FH}->read($$out, $get_size, $offset) }
66 elsif (defined *$self->{InputEvent}) {
68 while (length $$out < $size) {
70 if ($got = *$self->{InputEvent}->($$out, $get_size)) <= 0;
73 if (length $$out > $size ) {
74 #*$self->{Prime} = substr($$out, $size, length($$out), '');
75 *$self->{Prime} = substr($$out, $size, length($$out));
76 substr($$out, $size, length($$out)) = '';
79 *$self->{EventEof} = 1 if $got <= 0 ;
82 no warnings 'uninitialized';
83 my $buf = *$self->{Buffer} ;
84 $$buf = '' unless defined $$buf ;
85 #$$out = '' unless defined $$out ;
86 substr($$out, $offset) = substr($$buf, *$self->{BufferOffset}, $get_size);
87 *$self->{BufferOffset} += length($$out) - $offset ;
90 *$self->{InputLengthRemaining} -= length $$out;
92 $self->saveStatus(length $$out < 0 ? STATUS_ERROR : STATUS_OK) ;
101 return if ! defined $_[0] || length $_[0] == 0 ;
103 if (defined *$self->{FH} || defined *$self->{InputEvent} ) {
104 *$self->{Prime} = $_[0] . *$self->{Prime} ;
105 *$self->{InputLengthRemaining} += length($_[0]);
108 my $len = length $_[0];
110 if($len > *$self->{BufferOffset}) {
111 *$self->{Prime} = substr($_[0], 0, $len - *$self->{BufferOffset}) . *$self->{Prime} ;
112 *$self->{InputLengthRemaining} = *$self->{InputLength};
113 *$self->{BufferOffset} = 0
116 *$self->{InputLengthRemaining} += length($_[0]);
117 *$self->{BufferOffset} -= length($_[0]) ;
126 my $truncate = shift;
127 #print "smartSeek to $offset\n";
129 # TODO -- need to take prime into account
130 if (defined *$self->{FH})
131 { *$self->{FH}->seek($offset, SEEK_SET) }
133 *$self->{BufferOffset} = $offset ;
134 substr(${ *$self->{Buffer} }, *$self->{BufferOffset}) = ''
143 my $out_data = shift ;
145 if (defined *$self->{FH}) {
146 # flush needed for 5.8.0
147 defined *$self->{FH}->write($out_data, length $out_data) &&
148 defined *$self->{FH}->flush() ;
151 my $buf = *$self->{Buffer} ;
152 substr($$buf, *$self->{BufferOffset}, length $out_data) = $out_data ;
153 *$self->{BufferOffset} += length($out_data) ;
160 return $_[0]->smartRead($_[1], $_[2]) == $_[2];
168 return 0 if length *$self->{Prime};
170 if (defined *$self->{FH})
171 { *$self->{FH}->eof() }
172 elsif (defined *$self->{InputEvent})
173 { *$self->{EventEof} }
175 { *$self->{BufferOffset} >= length(${ *$self->{Buffer} }) }
182 *$self->{ErrorNo} = 0 ;
183 ${ *$self->{Error} } = '' ;
189 my $errno = shift() + 0 ;
190 #return $errno unless $errno || ! defined *$self->{ErrorNo};
191 #return $errno unless $errno ;
193 *$self->{ErrorNo} = $errno;
194 ${ *$self->{Error} } = '' ;
196 return *$self->{ErrorNo} ;
205 #return $retval if ${ *$self->{Error} };
207 ${ *$self->{Error} } = shift ;
208 *$self->{ErrorNo} = shift() + 0 if @_ ;
210 #warn "saveErrorString: " . ${ *$self->{Error} } . " " . *$self->{Error} . "\n" ;
217 $self->saveErrorString(0, $_[0]);
227 my $errno = *$self->{ErrorNo};
228 my $error = ${ *$self->{Error} };
232 *$self->{ErrorNo} = $errno ;
233 ${ *$self->{Error} } = $error ;
241 return ${ *$self->{Error} } ;
247 return *$self->{ErrorNo};
253 return $self->saveErrorString(undef, "Header Error: $_[0]", STATUS_ERROR);
259 return $self->saveErrorString(G_ERR, "Trailer Error: $_[0]", STATUS_ERROR);
265 return $self->HeaderError("Truncated in $_[0] Section");
271 return $self->TrailerError("Truncated in $_[0] Section");
279 my $got = shift || IO::Compress::Base::Parameters::new();
282 'BlockSize' => [1, 1, Parse_unsigned, 16 * 1024],
283 'AutoClose' => [1, 1, Parse_boolean, 0],
284 'Strict' => [1, 1, Parse_boolean, 0],
285 #'Lax' => [1, 1, Parse_boolean, 1],
286 'Append' => [1, 1, Parse_boolean, 0],
287 'Prime' => [1, 1, Parse_any, undef],
288 'MultiStream' => [1, 1, Parse_boolean, 0],
289 'Transparent' => [1, 1, Parse_any, 1],
290 'Scan' => [1, 1, Parse_boolean, 0],
291 'InputLength' => [1, 1, Parse_unsigned, undef],
292 'BinModeOut' => [1, 1, Parse_boolean, 0],
294 $self->getExtraParams(),
297 #'Todo - Revert to ordinary file on end Z_STREAM_END'=> 0,
302 $got->parse($Valid, @_ )
303 or $self->croakError("${class}: $got->{Error}") ;
313 my $append_mode = shift ;
315 my $class = ref $obj;
316 $obj->croakError("$class: Missing Input parameter")
319 my $inValue = shift ;
323 $got = $obj->checkParams($class, undef, @_)
327 my $inType = whatIsInput($inValue, 1);
329 $obj->ckInputParam($class, $inValue, 1)
335 or $obj->croakError("${class}: $obj->{Error}");
337 if ($inType eq 'buffer' || $inType eq 'code') {
338 *$obj->{Buffer} = $inValue ;
339 *$obj->{InputEvent} = $inValue
340 if $inType eq 'code' ;
343 if ($inType eq 'handle') {
344 *$obj->{FH} = $inValue ;
345 *$obj->{Handle} = 1 ;
346 # Need to rewind for Scan
347 #seek(*$obj->{FH}, 0, SEEK_SET) if $got->value('Scan');
348 *$obj->{FH}->seek(0, SEEK_SET) if $got->value('Scan');
352 $mode = '+<' if $got->value('Scan');
353 *$obj->{StdIO} = ($inValue eq '-');
354 *$obj->{FH} = new IO::File "$mode $inValue"
355 or return $obj->saveErrorString(undef, "cannot open file '$inValue': $!", $!) ;
358 *$obj->{LineNo} = $. = 0;
359 setBinModeInput(*$obj->{FH}) ;
362 *$obj->{Buffer} = \$buff ;
366 *$obj->{InputLength} = $got->parsed('InputLength')
367 ? $got->value('InputLength')
369 *$obj->{InputLengthRemaining} = $got->value('InputLength');
370 *$obj->{BufferOffset} = 0 ;
371 *$obj->{AutoClose} = $got->value('AutoClose');
372 *$obj->{Strict} = $got->value('Strict');
373 #*$obj->{Strict} = ! $got->value('Lax');
374 *$obj->{BlockSize} = $got->value('BlockSize');
375 *$obj->{Append} = $got->value('Append');
376 *$obj->{AppendOutput} = $append_mode || $got->value('Append');
377 *$obj->{Transparent} = $got->value('Transparent');
378 *$obj->{MultiStream} = $got->value('MultiStream');
380 # TODO - move these two into RawDeflate
381 *$obj->{Scan} = $got->value('Scan');
382 *$obj->{ParseExtra} = $got->value('ParseExtra')
383 || $got->value('Strict') ;
384 #|| ! $got->value('Lax') ;
386 *$obj->{Prime} = $got->value('Prime') || '' ;
387 *$obj->{Pending} = '';
389 *$obj->{PlainBytesRead} = 0;
390 *$obj->{InflatedBytesRead} = 0;
391 *$obj->{UnCompSize_32bit} = 0;
392 *$obj->{TotalInflatedBytesRead} = 0;
393 *$obj->{NewStream} = 0 ;
394 *$obj->{EventEof} = 0 ;
395 *$obj->{ClassName} = $class ;
396 *$obj->{Params} = $got ;
398 my $status = $obj->mkUncomp($class, $got);
401 unless defined $status;
405 unless *$obj->{Transparent};
408 *$obj->{Type} = 'plain';
410 #$status = $obj->mkIdentityUncomp($class, $got);
411 $obj->pushBack(*$obj->{HeaderPending}) ;
414 push @{ *$obj->{InfoList} }, *$obj->{Info} ;
416 $obj->saveStatus(STATUS_OK) ;
427 my $inType = whatIsInput($_[0], $_[1]);
429 $self->croakError("$from: input parameter not a filename, filehandle, array ref or scalar ref")
432 if ($inType eq 'filename' )
434 $self->croakError("$from: input filename is undef or null string")
435 if ! defined $_[0] || $_[0] eq '' ;
437 if ($_[0] ne '-' && ! -e $_[0] )
439 return $self->saveErrorString(undef,
440 "input file '$_[0]' does not exist", STATUS_ERROR);
452 my $class = (caller)[0] ;
453 my $name = (caller(1))[3] ;
455 $obj->croakError("$name: expected at least 1 parameters\n")
463 my $x = new Validator($class, *$obj->{Error}, $name, $input, $output)
466 push @_, $output if $haveOut && $x->{Hash};
468 my $got = $obj->checkParams($name, undef, @_)
475 while (my($k, $v) = each %$input)
480 $obj->_singleTarget($x, 1, $k, $v, @_)
484 return keys %$input ;
490 foreach my $pair (@{ $x->{Pairs} })
492 my ($from, $to) = @$pair ;
493 $obj->_singleTarget($x, 1, $from, $to, @_)
497 return scalar @{ $x->{Pairs} } ;
500 #if ($x->{outType} eq 'array' || $x->{outType} eq 'hash')
501 if (! $x->{oneOutput} )
503 my $inFile = ($x->{inType} eq 'filenames'
504 || $x->{inType} eq 'filename');
506 $x->{inType} = $inFile ? 'filename' : 'buffer';
507 my $ot = $x->{outType} ;
508 $x->{outType} = 'buffer';
510 foreach my $in ($x->{oneInput} ? $input : @$input)
515 $obj->_singleTarget($x, $inFile, $in, \$out, @_)
519 { push @$output, \$out }
521 { $output->{$in} = \$out }
527 # finally the 1 to 1 and n to 1
528 return $obj->_singleTarget($x, 1, $input, $output, @_);
530 croak "should not be here" ;
538 ${ $x->{Error} } = $string ;
547 my $inputIsFilename = shift;
554 if ($x->{outType} eq 'filename') {
557 if $x->{Got}->value('Append') ;
558 $x->{fh} = new IO::File "$mode $output"
559 or return retErr($x, "cannot open file '$output': $!") ;
560 binmode $x->{fh} if $x->{Got}->valueOrDefault('BinModeOut');
564 elsif ($x->{outType} eq 'handle') {
566 binmode $x->{fh} if $x->{Got}->valueOrDefault('BinModeOut');
567 if ($x->{Got}->value('Append')) {
568 seek($x->{fh}, 0, SEEK_END)
569 or return retErr($x, "Cannot seek to end of output filehandle: $!") ;
574 elsif ($x->{outType} eq 'buffer' )
577 unless $x->{Got}->value('Append');
578 $x->{buff} = $output ;
583 defined $self->_rd2($x, $input, $inputIsFilename)
588 my $inputIsFilename = ($x->{inType} ne 'array');
590 for my $element ( ($x->{inType} eq 'hash') ? keys %$input : @$input)
592 defined $self->_rd2($x, $element, $inputIsFilename)
598 if ( ($x->{outType} eq 'filename' && $output ne '-') ||
599 ($x->{outType} eq 'handle' && $x->{Got}->value('AutoClose'))) {
601 or return retErr($x, $!);
602 #or return $gunzip->saveErrorString(undef, $!, $!);
614 my $inputIsFilename = shift;
616 my $z = createSelfTiedObject($x->{Class}, *$self->{Error});
618 $z->_create($x->{Got}, 1, $input, @_)
624 while (($status = $z->read($x->{buff})) > 0) {
627 or return $z->saveErrorString(undef, "Error writing to output file: $!", $!);
632 return $z->closeError(undef)
643 return $_[0] if ref($_[0]);
657 wantarray ? @{ *$self->{InfoList} } : *$self->{Info};
666 if (defined *$self->{CompressedInputLength}) {
667 if (*$self->{CompressedInputLengthRemaining} == 0) {
668 delete *$self->{CompressedInputLength};
669 *$self->{CompressedInputLengthDone} = 1;
672 $size = min($size, *$self->{CompressedInputLengthRemaining} );
673 *$self->{CompressedInputLengthRemaining} -= $size ;
676 my $status = $self->smartRead($buff, $size) ;
677 return $self->saveErrorString(STATUS_ERROR, "Error Reading Data")
681 *$self->{Closed} = 1 ;
682 *$self->{EndStream} = 1 ;
683 return $self->saveErrorString(STATUS_ERROR, "unexpected end of file", STATUS_ERROR);
698 # >0 - ok, number of bytes read
704 return G_EOF if *$self->{Closed} ;
705 #return G_EOF if !length *$self->{Pending} && *$self->{EndStream} ;
706 return G_EOF if *$self->{EndStream} ;
709 my $scan_mode = shift ;
711 if (*$self->{Plain}) {
713 my $len = $self->smartRead(\$tmp_buff, *$self->{BlockSize}) ;
715 return $self->saveErrorString(G_ERR, "Error reading data: $!", $!)
719 *$self->{EndStream} = 1 ;
722 *$self->{PlainBytesRead} += $len ;
723 $$buffer .= $tmp_buff;
729 if (*$self->{NewStream}) {
731 *$self->{NewStream} = 0 ;
732 *$self->{EndStream} = 0 ;
736 unless my $magic = $self->ckMagic();
737 *$self->{Info} = $self->readHeader($magic);
739 return G_ERR unless defined *$self->{Info} ;
741 push @{ *$self->{InfoList} }, *$self->{Info} ;
743 # For the headers that actually uncompressed data, put the
744 # uncompressed data into the output buffer.
745 $$buffer .= *$self->{Pending} ;
746 my $len = length *$self->{Pending} ;
747 *$self->{Pending} = '';
753 my $status = $self->readBlock(\$temp_buf, *$self->{BlockSize}, $outSize) ;
755 if $status == STATUS_ERROR ;
758 if ($status == STATUS_OK) {
759 my $before_len = defined $$buffer ? length $$buffer : 0 ;
760 $status = *$self->{Uncomp}->uncompr(\$temp_buf, $buffer,
761 defined *$self->{CompressedInputLengthDone} ||
762 $self->smartEof(), $outSize);
763 # (defined *$self->{CompressedInputLength} &&
764 # *$self->{CompressedInputLengthRemaining} < 0) ||
765 # $self->smartEof(), $outSize);
767 return $self->saveErrorString(G_ERR, *$self->{Uncomp}{Error}, *$self->{Uncomp}{ErrorNo})
768 if $self->saveStatus($status) == STATUS_ERROR;
770 $self->postBlockChk($buffer) == STATUS_OK
773 $self->filterUncompressed($buffer);
775 #$buf_len = *$self->{Uncomp}->count();
776 $buf_len = length($$buffer) - $before_len;
779 *$self->{InflatedBytesRead} += $buf_len ;
780 *$self->{TotalInflatedBytesRead} += $buf_len ;
781 my $rest = 0xFFFFFFFF - *$self->{UnCompSize_32bit} ;
782 if ($buf_len > $rest) {
783 *$self->{UnCompSize_32bit} = $buf_len - $rest - 1;
786 *$self->{UnCompSize_32bit} += $buf_len ;
790 if ($status == STATUS_ENDSTREAM) {
792 *$self->{EndStream} = 1 ;
793 $self->pushBack($temp_buf) ;
797 my $trailer_size = *$self->{Info}{TrailerLength} ;
799 if (*$self->{Info}{TrailerLength})
801 $got = $self->smartRead(\$trailer, $trailer_size) ;
804 if ($got == $trailer_size) {
805 $self->chkTrailer($trailer) == STATUS_OK
809 return $self->TrailerError("trailer truncated. Expected " .
810 "$trailer_size bytes, got $got")
812 $self->pushBack($trailer) ;
815 if (*$self->{MultiStream} && ! $self->smartEof()) {
816 #&& (length $temp_buf || ! $self->smartEof())){
817 *$self->{NewStream} = 1 ;
818 *$self->{EndStream} = 0 ;
825 # return the number of uncompressed bytes read
833 return *$self->{Uncomp}->reset();
836 sub filterUncompressed
843 # return *$self->{NewStream} ||
844 # *$self->{EndStream} ;
850 return 1 if ! defined *$self->{InfoList};
851 return scalar @{ *$self->{InfoList} } ;
857 # >0 - ok, number of bytes read
863 return G_EOF if *$self->{Closed} ;
864 return G_EOF if !length *$self->{Pending} && *$self->{EndStream} ;
868 #$self->croakError(*$self->{ClassName} .
869 # "::read: buffer parameter is read-only")
870 # if Compress::Raw::Zlib::_readonly_ref($_[0]);
873 $self->croakError(*$self->{ClassName} . "::read: buffer parameter is read-only")
874 if readonly(${ $_[0] });
876 $self->croakError(*$self->{ClassName} . "::read: not a scalar reference $_[0]" )
877 unless ref $_[0] eq 'SCALAR' ;
881 $self->croakError(*$self->{ClassName} . "::read: buffer parameter is read-only")
888 my $offset = $_[2] || 0;
890 # the core read will return 0 if asked for 0 bytes
891 return 0 if defined $length && $length == 0 ;
893 $length = $length || 0;
895 $self->croakError(*$self->{ClassName} . "::read: length parameter is negative")
898 $$buffer = '' unless *$self->{AppendOutput} || $offset ;
900 # Short-circuit if this is a simple read, with no length
901 # or offset specified.
902 unless ( $length || $offset) {
903 if (length *$self->{Pending}) {
904 $$buffer .= *$self->{Pending} ;
905 my $len = length *$self->{Pending};
906 *$self->{Pending} = '' ;
911 $len = $self->_raw_read($buffer)
912 while ! *$self->{EndStream} && $len == 0 ;
917 # Need to jump through more hoops - either length or offset
918 # or both are specified.
919 my $out_buffer = \*$self->{Pending} ;
921 while (! *$self->{EndStream} && length($$out_buffer) < $length)
923 my $buf_len = $self->_raw_read($out_buffer);
928 $length = length $$out_buffer
929 if length($$out_buffer) < $length ;
932 $$buffer .= "\x00" x ($offset - length($$buffer))
933 if $offset > length($$buffer) ;
934 #substr($$buffer, $offset) = substr($$out_buffer, 0, $length, '') ;
935 substr($$buffer, $offset) = substr($$out_buffer, 0, $length) ;
936 substr($$out_buffer, 0, $length) = '' ;
939 #$$buffer .= substr($$out_buffer, 0, $length, '') ;
940 $$buffer .= substr($$out_buffer, 0, $length) ;
941 substr($$out_buffer, 0, $length) = '' ;
952 if ( ! defined $/ ) {
954 1 while $self->read($data) > 0 ;
955 $. = ++ *$self->{LineNo} if defined($data);
962 while ($self->read($paragraph) > 0 ) {
963 if ($paragraph =~ s/^(.*?\n\n+)//s) {
964 *$self->{Pending} = $paragraph ;
966 $. = ++ *$self->{LineNo} ;
970 $. = ++ *$self->{LineNo} if defined($paragraph);
977 my $endl = quotemeta($/); # quote in case $/ contains RE meta chars
978 while ($self->read($line) > 0 ) {
979 if ($line =~ s/^(.*?$endl)//s) {
980 *$self->{Pending} = $line ;
981 $. = ++ *$self->{LineNo} ;
986 $. = ++ *$self->{LineNo} if defined($line);
994 my $current_append = *$self->{AppendOutput} ;
995 *$self->{AppendOutput} = 1;
996 my $lineref = $self->_getline();
997 *$self->{AppendOutput} = $current_append;
1004 $self->croakError(*$self->{ClassName} .
1005 "::getlines: called in scalar context\n") unless wantarray;
1007 push(@lines, $line) while defined($line = $self->getline);
1013 goto &getlines if wantarray;
1021 return $buf if $self->read($buf, 1);
1028 *$self->{Pending} = "" unless defined *$self->{Pending} ;
1029 *$self->{Pending} = $_[0] . *$self->{Pending} ;
1036 #return \"" if ! defined *$self->{Trailing} ;
1037 #return \*$self->{Trailing} ;
1039 if (defined *$self->{FH} || defined *$self->{InputEvent} ) {
1040 return *$self->{Prime} ;
1043 my $buf = *$self->{Buffer} ;
1044 my $offset = *$self->{BufferOffset} ;
1045 return substr($$buf, $offset, -1) ;
1054 return (*$self->{Closed} ||
1055 (!length *$self->{Pending}
1056 && ( $self->smartEof() || *$self->{EndStream}))) ;
1064 if (*$self->{Plain}) {
1065 $in = *$self->{PlainBytesRead} ;
1068 $in = *$self->{TotalInflatedBytesRead} ;
1071 my $pending = length *$self->{Pending} ;
1073 return 0 if $pending > $in ;
1074 return $in - $pending ;
1079 # todo - what to do if close is called before the end of the gzip file
1080 # do we remember any trailing data?
1083 return 1 if *$self->{Closed} ;
1090 if (defined *$self->{FH}) {
1091 if ((! *$self->{Handle} || *$self->{AutoClose}) && ! *$self->{StdIO}) {
1092 #if ( *$self->{AutoClose}) {
1095 $status = *$self->{FH}->close();
1096 return $self->saveErrorString(0, $!, $!)
1097 if !*$self->{InNew} && $self->saveStatus($!) != 0 ;
1099 delete *$self->{FH} ;
1102 *$self->{Closed} = 1 ;
1116 my $position = shift;
1117 my $whence = shift ;
1119 my $here = $self->tell() ;
1123 if ($whence == SEEK_SET) {
1124 $target = $position ;
1126 elsif ($whence == SEEK_CUR) {
1127 $target = $here + $position ;
1129 elsif ($whence == SEEK_END) {
1130 $target = $position ;
1131 $self->croakError(*$self->{ClassName} . "::seek: SEEK_END not allowed") ;
1134 $self->croakError(*$self->{ClassName} ."::seek: unknown value, $whence, for whence parameter");
1137 # short circuit if seeking to current offset
1138 return 1 if $target == $here ;
1140 # Outlaw any attempt to seek backwards
1141 $self->croakError( *$self->{ClassName} ."::seek: cannot seek backwards")
1142 if $target < $here ;
1144 # Walk the file to the new offset
1145 my $offset = $target - $here ;
1148 $self->read($buffer, $offset) == $offset
1157 return defined *$self->{FH}
1158 ? fileno *$self->{FH}
1165 # my $self = shift ;
1166 # return defined *$self->{FH}
1167 # ? binmode *$self->{FH}
1174 return ! *$self->{Closed} ;
1180 return defined *$self->{FH}
1181 ? *$self->{FH}->autoflush(@_)
1185 sub input_line_number
1188 my $last = *$self->{LineNo};
1189 $. = *$self->{LineNo} = $_[1] if @_ ;
1194 *BINMODE = \&binmode;
1207 #return sub { croak "$name Not Available" ; } ;
1208 return sub { croak "$name Not Available: File opened only for intput" ; } ;
1212 *print = _notAvailable('print');
1213 *PRINT = _notAvailable('print');
1214 *printf = _notAvailable('printf');
1215 *PRINTF = _notAvailable('printf');
1216 *write = _notAvailable('write');
1217 *WRITE = _notAvailable('write');
1220 #*syswrite = \&_notAvailable;
1222 #package IO::_infScan ;
1224 #*_raw_read = \&IO::Uncompress::Base::_raw_read ;
1225 #*smartRead = \&IO::Uncompress::Base::smartRead ;
1226 #*smartWrite = \&IO::Uncompress::Base::smartWrite ;
1227 #*smartSeek = \&IO::Uncompress::Base::smartSeek ;
1229 #sub mkIdentityUncomp
1231 # my $self = shift ;
1232 # my $class = shift ;
1235 # *$self->{Uncomp} = UncompressPlugin::Identity::mkUncompObject($self, $class, $got)
1243 #package UncompressPlugin::Identity;
1248 #our ($VERSION, @ISA, @EXPORT);
1250 #$VERSION = '2.000_05';
1252 #use constant STATUS_OK => 0;
1253 #use constant STATUS_ENDSTREAM => 1;
1254 #use constant STATUS_ERROR => 2;
1258 # my $class = shift ;
1260 # bless { 'CompSize' => 0,
1261 # 'UnCompSize' => 0,
1269 # my $self = shift ;
1270 # my $from = shift ;
1275 # $self->{CompSize} += length $$from ;
1276 # $self->{UnCompSize} = $self->{CompSize} ;
1280 # return STATUS_ENDSTREAM if $eof;
1281 # return STATUS_OK ;
1286 # my $self = shift ;
1287 # return $self->{UnCompSize} ;
1292 # return STATUS_OK ;
1298 package IO::Uncompress::Base ;
1307 IO::Uncompress::Base - Base Class for IO::Uncompress modules
1312 use IO::Uncompress::Base ;
1317 This module is not intended for direct use in application code. Its sole
1318 purpose if to to be sub-classed by IO::Unompress modules.
1325 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::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>
1327 L<Compress::Zlib::FAQ|Compress::Zlib::FAQ>
1329 L<File::GlobMapper|File::GlobMapper>, L<Archive::Zip|Archive::Zip>,
1330 L<Archive::Tar|Archive::Tar>,
1331 L<IO::Zlib|IO::Zlib>
1339 This module was written by Paul Marquess, F<pmqs@cpan.org>.
1343 =head1 MODIFICATION HISTORY
1345 See the Changes file.
1347 =head1 COPYRIGHT AND LICENSE
1349 Copyright (c) 2005-2006 Paul Marquess. All rights reserved.
1351 This program is free software; you can redistribute it and/or
1352 modify it under the same terms as Perl itself.