1 package IO::Uncompress::Adapter::Inflate;
7 use IO::Compress::Base::Common qw(:Status);
8 use Compress::Raw::Zlib qw(Z_OK Z_DATA_ERROR Z_STREAM_END Z_FINISH MAX_WBITS);
11 $VERSION = '2.000_10';
17 my $crc32 = shift || 1;
18 my $adler32 = shift || 1;
19 my $scan = shift || 0;
26 ($inflate, $status) = new Compress::Raw::Zlib::InflateScan
29 WindowBits => - MAX_WBITS ;
33 ($inflate, $status) = new Compress::Raw::Zlib::Inflate
37 WindowBits => - MAX_WBITS ;
40 return (undef, "Could not create Inflation object: $status", $status)
43 return bless {'Inf' => $inflate,
58 my $inf = $self->{Inf};
60 my $status = $inf->inflate($from, $to, $eof);
61 $self->{ErrorNo} = $status;
63 if ($status != Z_STREAM_END && $eof)
65 $self->{Error} = "unexpected end of file";
69 if ($status != Z_OK && $status != Z_STREAM_END )
71 $self->{Error} = "Inflation Error: $status";
76 return STATUS_OK if $status == Z_OK ;
77 return STATUS_ENDSTREAM if $status == Z_STREAM_END ;
84 $self->{Inf}->inflateReset();
92 # $self->{Inf}->inflateCount();
98 $self->{Inf}->crc32();
104 $self->{Inf}->compressedBytes();
107 sub uncompressedBytes
110 $self->{Inf}->uncompressedBytes();
116 $self->{Inf}->adler32();
122 ( $self->{Inf}->inflateSync(@_) == Z_OK)
128 sub getLastBlockOffset
131 $self->{Inf}->getLastBlockOffset();
137 $self->{Inf}->getEndOffset();
140 sub resetLastBlockByte
143 $self->{Inf}->resetLastBlockByte(@_);
146 sub createDeflateStream
149 my $deflate = $self->{Inf}->createDeflateStream(@_);
150 return bless {'Def' => $deflate,
154 }, 'IO::Compress::Adapter::Deflate';