=head1 NAME SWF::BinStream::Codec - Document for SWF::BinStream codecs. =head1 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; =head1 DESCRIPTION I package provides additive codecs for I. The whole package name must be 'SWF::BinStream::Codec::I<[name]>'. I use the package when its I method is called with the I. Two sub package, 'SWF::BinStream::Codec::I<[name]>::Read' and 'SWF::BinStream::Codec::I<[name]>::Write' should contain the package. =head2 METHODS The codec class must equip these methods. Each method should I when error occurs. =head3 SWF::BinStream::I<[name]>::Read =over 4 =item SWF::BinStream::I<[name]>::Read->new; should return a new decoder. It does not take any parameters. =item $codec->decode( $data ); is called with the data read from the stream. It should return decoded data. =item $codec->close; is called when the stream is closed. It does not take any parameters. =back =head3 SWF::BinStream::I<[name]>::Write =over 4 =item SWF::BinStream::I<[name]>::Write->new; should return a new encoder. It does not take any parameters. =item $codec->encode( $data ); is called with the data to write to the stream. It should return encoded data. =item $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. =back =head1 COPYRIGHT Copyright 2002 Yasuhiro Sasama (ySas), This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =cut