Yasuhiro Sasama > SWF-File-0.31 > SWF::BinStream::Codec

Download:
SWF-File-0.31.tar.gz

Annotate this POD

CPAN RT

New  2
Open  0
View/Report Bugs
Source   Latest Release: SWF-File-0.42

NAME ^

SWF::BinStream::Codec - Document for SWF::BinStream codecs.

SYNOPSIS ^

  use SWF::BinStream;
  ....
  $stream->add_codec('Foo');

  ----

  package SWF::BinStream::Codec::Foo;

  $VERSION='x.xx';

  package SWF::BinStream::Codec::Foo::Read;

  sub new {}
  sub decode {}
  sub close {}

  package SWF::BinStream::Codec::Foo::Write;

  sub new {}
  sub encode {}
  sub close {}

  1;

DESCRIPTION ^

SWF::BinStream:Codec::* package provides additive codecs for SWF::BinStream.

The whole package name must be 'SWF::BinStream::Codec::[name]'. SWF::BinStream use the package when its add_codec method is called with the name. Two sub package, 'SWF::BinStream::Codec::[name]::Read' and 'SWF::BinStream::Codec::[name]::Write' should contain the package.

METHODS

The codec class must equip these methods. Each method should die when error occurs.

SWF::BinStream::[name]::Read

SWF::BinStream::[name]::Read->new;

should return a new decoder. It does not take any parameters.

$codec->decode( $data );

is called with the data read from the stream. It should return decoded data.

$codec->close;

is called when the stream is closed. It does not take any parameters.

SWF::BinStream::[name]::Write

SWF::BinStream::[name]::Write->new;

should return a new encoder. It does not take any parameters.

$codec->encode( $data );

is called with the data to write to the stream. It should return encoded data.

$codec->close( $data );

is called when the stream is to be closed. It is called with the rest of bufferred data. It should return encoded data.

COPYRIGHT ^

Copyright 2002 Yasuhiro Sasama (ySas), <ysas@nmt.ne.jp>

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

syntax highlighting: