1 package UncompressPlugin::Inflate;
6 use Compress::Zlib::Common qw(:Status);
7 use Compress::Zlib qw(Z_OK Z_DATA_ERROR Z_STREAM_END Z_FINISH MAX_WBITS);
10 $VERSION = '2.000_05';
16 my $crc32 = shift || 1;
17 my $adler32 = shift || 1;
18 my $scan = shift || 0;
25 ($inflate, $status) = new Compress::Zlib::InflateScan
28 WindowBits => - MAX_WBITS ;
32 ($inflate, $status) = new Compress::Zlib::Inflate
36 WindowBits => - MAX_WBITS ;
39 return (undef, "Could not create Inflation object: $status", $status)
42 return bless {'Inf' => $inflate,
57 my $inf = $self->{Inf};
59 my $status = $inf->inflate($from, $to, $eof);
60 $self->{ErrorNo} = $status;
62 if ($status != Z_STREAM_END && $eof)
64 $self->{Error} = "unexpected end of file";
68 if ($status != Z_OK && $status != Z_STREAM_END )
70 $self->{Error} = "Inflation Error: $status";
75 return STATUS_OK if $status == Z_OK ;
76 return STATUS_ENDSTREAM if $status == Z_STREAM_END ;
83 $self->{Inf}->inflateReset();
91 $self->{Inf}->inflateCount();
97 $self->{Inf}->crc32();
103 $self->{Inf}->compressedBytes();
106 sub uncompressedBytes
109 $self->{Inf}->uncompressedBytes();
115 $self->{Inf}->adler32();
121 ( $self->{Inf}->inflateSync(@_) == Z_OK)
127 sub getLastBlockOffset
130 $self->{Inf}->getLastBlockOffset();
136 $self->{Inf}->getEndOffset();
139 sub resetLastBlockByte
142 $self->{Inf}->resetLastBlockByte(@_);
145 sub createDeflateStream
148 my $deflate = $self->{Inf}->createDeflateStream(@_);
149 return bless {'Def' => $deflate,
153 }, 'CompressPlugin::Deflate';