GIF89a;
EcchiShell v1.0
/
/
proc/
self/
root/
usr/
share/
perl5/
_create(undef, 0, @_);
}
sub bunzip2
{
my $obj = IO::Compress::Base::Common::createSelfTiedObject(undef, \$Bunzip2Error);
return $obj->_inf(@_);
}
sub getExtraParams
{
return (
'verbosity' => [IO::Compress::Base::Common::Parse_boolean, 0],
'small' => [IO::Compress::Base::Common::Parse_boolean, 0],
);
}
sub ckParams
{
my $self = shift ;
my $got = shift ;
return 1;
}
sub mkUncomp
{
my $self = shift ;
my $got = shift ;
my $magic = $self->ckMagic()
or return 0;
*$self->{Info} = $self->readHeader($magic)
or return undef ;
my $Small = $got->getValue('small');
my $Verbosity = $got->getValue('verbosity');
my ($obj, $errstr, $errno) = IO::Uncompress::Adapter::Bunzip2::mkUncompObject(
$Small, $Verbosity);
return $self->saveErrorString(undef, $errstr, $errno)
if ! defined $obj;
*$self->{Uncomp} = $obj;
return 1;
}
sub ckMagic
{
my $self = shift;
my $magic ;
$self->smartReadExact(\$magic, 4);
*$self->{HeaderPending} = $magic ;
return $self->HeaderError("Header size is " .
4 . " bytes")
if length $magic != 4;
return $self->HeaderError("Bad Magic.")
if ! isBzip2Magic($magic) ;
*$self->{Type} = 'bzip2';
return $magic;
}
sub readHeader
{
my $self = shift;
my $magic = shift ;
$self->pushBack($magic);
*$self->{HeaderPending} = '';
return {
'Type' => 'bzip2',
'FingerprintLength' => 4,
'HeaderLength' => 4,
'TrailerLength' => 0,
'Header' => '$magic'
};
}
sub chkTrailer
{
return STATUS_OK;
}
sub isBzip2Magic
{
my $buffer = shift ;
return $buffer =~ /^BZh\d$/;
}
1 ;
__END__
=head1 NAME
IO::Uncompress::Bunzip2 - Read bzip2 files/buffers
=head1 SYNOPSIS
use IO::Uncompress::Bunzip2 qw(bunzip2 $Bunzip2Error) ;
my $status = bunzip2 $input => $output [,OPTS]
or die "bunzip2 failed: $Bunzip2Error\n";
my $z = new IO::Uncompress::Bunzip2 $input [OPTS]
or die "bunzip2 failed: $Bunzip2Error\n";
$status = $z->read($buffer)
$status = $z->read($buffer, $length)
$status = $z->read($buffer, $length, $offset)
$line = $z->getline()
$char = $z->getc()
$char = $z->ungetc()
$char = $z->opened()
$data = $z->trailingData()
$status = $z->nextStream()
$data = $z->getHeaderInfo()
$z->tell()
$z->seek($position, $whence)
$z->binmode()
$z->fileno()
$z->eof()
$z->close()
$Bunzip2Error ;
# IO::File mode
<$z>
read($z, $buffer);
read($z, $buffer, $length);
read($z, $buffer, $length, $offset);
tell($z)
seek($z, $position, $whence)
binmode($z)
fileno($z)
eof($z)
close($z)
=head1 DESCRIPTION
This module provides a Perl interface that allows the reading of
bzip2 files/buffers.
For writing bzip2 files/buffers, see the companion module IO::Compress::Bzip2.
=head1 Functional Interface
A top-level function, C, is provided to carry out
"one-shot" uncompression between buffers and/or files. For finer
control over the uncompression process, see the L"OO Interface">
section.
use IO::Uncompress::Bunzip2 qw(bunzip2 $Bunzip2Error) ;
bunzip2 $input => $output [,OPTS]
or die "bunzip2 failed: $Bunzip2Error\n";
The functional interface needs Perl5.005 or better.
=head2 bunzip2 $input => $output [, OPTS]
C expects at least two parameters, C<$input> and C<$output>.
=head3 The C<$input> parameter
The parameter, C<$input>, is used to define the source of
the compressed data.
It can take one of the following forms:
=over 5
=item A filename
If the C<$input> parameter is a simple scalar, it is assumed to be a
filename. This file will be opened for reading and the input data
will be read from it.
=item A filehandle
If the C<$input> parameter is a filehandle, the input data will be
read from it.
The string '-' can be used as an alias for standard input.
=item A scalar reference
If C<$input> is a scalar reference, the input data will be read
from C<$$input>.
=item An array reference
If C<$input> is an array reference, each element in the array must be a
filename.
The input data will be read from each file in turn.
The complete array will be walked to ensure that it only
contains valid filenames before any data is uncompressed.
=item An Input FileGlob string
If C<$input> is a string that is delimited by the characters "<" and ">"
C will assume that it is an I. The
input is the list of files that match the fileglob.
If the fileglob does not match any files ...
See L for more details.
=back
If the C<$input> parameter is any other type, C will be returned.
=head3 The C<$output> parameter
The parameter C<$output> is used to control the destination of the
uncompressed data. This parameter can take one of these forms.
=over 5
=item A filename
If the C<$output> parameter is a simple scalar, it is assumed to be a
filename. This file will be opened for writing and the uncompressed
data will be written to it.
=item A filehandle
If the C<$output> parameter is a filehandle, the uncompressed data
will be written to it.
The string '-' can be used as an alias for standard output.
=item A scalar reference
If C<$output> is a scalar reference, the uncompressed data will be
stored in C<$$output>.
=item An Array Reference
If C<$output> is an array reference, the uncompressed data will be
pushed onto the array.
=item An Output FileGlob
If C<$output> is a string that is delimited by the characters "<" and ">"
C will assume that it is an I