None available.
sub CLOSE
{
my $self = shift;
return undef unless defined($self->{'gz'});
my $output = '';
my $status = $self->{'gz'}->flush(\$output);
my $fileh = $self->{'fileh'};
print $fileh $output.pack("V V", $self->{'gz'}->crc32(), $self->{'gz'}->total_in());
delete $self->{'gz'};
delete $self->{'fileh'};
return ($status == Compress::Zlib::Z_OK) ? 1 : undef; } |
sub OPEN
{
my $self = shift;
my $fileh = shift;
$self->{'fileh'} = $fileh;
$self->{'gz'} = new Compress::Raw::Zlib::Deflate(
-AppendOutput => 1,
-CRC32 => 1,
-ADLER32 => 0,
-Level => Z_BEST_COMPRESSION(),
-WindowBits => - MAX_WBITS(),
)
or croak "$self: Cannot create deflation streami\n";
binmode $fileh;
print $fileh IO::Compress::Gzip::GZIP_MINIMUM_HEADER ;
return defined($self->{'gz'}) ? $self : undef; } |
sub TIEHANDLE
{
my $class = shift;
my @args = @_;
my $self = bless {}, $class;
return @args ? $self->OPEN(@args) : $self; } |
sub WRITE
{
my $self = shift;
my $buf = shift;
my $length = shift;
my $offset = shift;
$self->OPEN unless $self->{'gz'};
croak "BioMart::Zlib::WRITE: too long LENGTH" unless $length <= length($buf);
croak "BioMart::Zlib::WRITE: OFFSET not supported" if defined($offset) && $offset != 0;
my $data = substr($buf,0,$length);
my $output = '';
my $status = $self->{'gz'}->deflate($data,\$output);
my $fileh = $self->{'fileh'};
print $fileh $output;
return ($status==Compress::Zlib::Z_OK) ? $length : undef; } |
sub new
{
my $class = shift;
my @args = @_;
my $self = gensym();
tie *{$self}, $class, @args;
return tied(${$self}) ? bless $self, $class : undef; } |