1
2=head1 NAME
3
4SWF::BinStream::Codec - Document for SWF::BinStream codecs.
5
6=head1 SYNOPSIS
7
8  use SWF::BinStream;
9  ....
10  $stream->add_codec('Foo');
11
12  ----
13
14  package SWF::BinStream::Codec::Foo;
15
16  $VERSION='x.xx';
17
18  package SWF::BinStream::Codec::Foo::Read;
19
20  sub new {}
21  sub decode {}
22  sub close {}
23
24  package SWF::BinStream::Codec::Foo::Write;
25
26  sub new {}
27  sub encode {}
28  sub close {}
29
30  1;
31
32=head1 DESCRIPTION
33
34I<SWF::BinStream:Codec::*> package provides additive codecs for I<SWF::BinStream>.
35
36The whole package name must be 'SWF::BinStream::Codec::I<[name]>'.
37I<SWF::BinStream> use the package when its I<add_codec> method is called with the I<name>.
38Two sub package, 'SWF::BinStream::Codec::I<[name]>::Read' and 'SWF::BinStream::Codec::I<[name]>::Write'
39should contain the package.
40
41=head2 METHODS
42
43The codec class must equip these methods. Each method should I<die> when error occurs.
44
45=head3 SWF::BinStream::I<[name]>::Read
46
47=over 4
48
49=item SWF::BinStream::I<[name]>::Read->new;
50
51should return a new decoder. It does not take any parameters.
52
53=item $codec->decode( $data );
54
55is called with the data read from the stream.
56It should return decoded data.
57
58=item $codec->close;
59
60is called when the stream is closed.
61It does not take any parameters.
62
63=back
64
65=head3 SWF::BinStream::I<[name]>::Write
66
67=over 4
68
69=item SWF::BinStream::I<[name]>::Write->new;
70
71should return a new encoder. It does not take any parameters.
72
73=item $codec->encode( $data );
74
75is called with the data to write to the stream.
76It should return encoded data.
77
78=item $codec->close( $data );
79
80is called when the stream is to be closed.
81It is called with the rest of bufferred data.
82It should return encoded data.
83
84=back
85
86=head1 COPYRIGHT
87
88Copyright 2002 Yasuhiro Sasama (ySas), <ysas@nmt.ne.jp>
89
90This library is free software; you can redistribute it
91and/or modify it under the same terms as Perl itself.
92
93=cut