Gnash  0.8.10
Public Member Functions
gnash::IOChannel Class Reference

A virtual IO channel. More...

#include <IOChannel.h>

Inheritance diagram for gnash::IOChannel:
gnash::Socket

List of all members.

Public Member Functions

virtual ~IOChannel ()
boost::uint32_t read_le32 ()
 Read a 32-bit word from a little-endian stream. returning it as a native-endian word.
boost::uint16_t read_le16 ()
 Read a 16-bit word from a little-endian stream.
boost::uint8_t read_byte ()
 Read a single byte from the stream.
virtual std::streamsize read (void *dst, std::streamsize num)=0
 Read the given number of bytes from the stream.
virtual std::streamsize readNonBlocking (void *dst, std::streamsize num)
 Read at most the given number of bytes w/out blocking.
virtual std::streamsize write (const void *src, std::streamsize num)
 Write the given number of bytes to the stream.
int read_string (char *dst, int max_length)
 Read up to max_length characters, returns the number of characters read, or -1 if the string length is longer than max_length.
float read_float32 ()
 Read a 32-bit float from a little-endian stream.
virtual std::streampos tell () const =0
 Return current stream position.
virtual bool seek (std::streampos p)=0
 Seek to the specified position.
virtual void go_to_end ()=0
 Seek to the end of the stream.
virtual bool eof () const =0
 Return true if the end of the stream has been reached.
virtual bool bad () const =0
 Return true if the stream is in an error state.
virtual size_t size () const
 Get the size of the stream (unreliably).

Detailed Description

A virtual IO channel.


Constructor & Destructor Documentation

virtual gnash::IOChannel::~IOChannel ( ) [inline, virtual]

Member Function Documentation

virtual bool gnash::IOChannel::bad ( ) const [pure virtual]

Return true if the stream is in an error state.

When the stream is in an error state there's nothing you can do about it, just delete it and log the error.

Implemented in gnash::Socket.

virtual bool gnash::IOChannel::eof ( ) const [pure virtual]

Return true if the end of the stream has been reached.

Throw IOException on error

Implemented in gnash::Socket.

virtual void gnash::IOChannel::go_to_end ( ) [pure virtual]

Seek to the end of the stream.

Throw IOException on error

Implemented in gnash::Socket.

Referenced by gnash::SWFStream::consumeInput().

virtual std::streamsize gnash::IOChannel::read ( void *  dst,
std::streamsize  num 
) [pure virtual]

Read the given number of bytes from the stream.

Return the number of bytes actually read. EOF might cause it to be < num.

Throw IOException on error

Implemented in gnash::Socket.

Referenced by read_byte(), gnash::media::MediaHandler::isFLV(), gnash::SWFStream::read(), and gnash::SWFStream::read_uint().

boost::uint8_t gnash::IOChannel::read_byte ( )

Read a single byte from the stream.

Throw IOException on error

References gnash::key::u, and read().

Referenced by read_le32(), read_le16(), read_string(), gnash::SWFStream::read_bit(), gnash::SWFStream::read_uint(), and gnash::SWFStream::read_u8().

float gnash::IOChannel::read_float32 ( )

Read a 32-bit float from a little-endian stream.

NOTE: this currently relies on host FP format being the same as the Flash one (presumably IEEE 754). Throw IOException on error

References gnash::key::f, gnash::key::i, gnash::key::u, and read_le32().

boost::uint16_t gnash::IOChannel::read_le16 ( )

Read a 16-bit word from a little-endian stream.

Throw IOException on error

References read_byte().

Referenced by gnash::SWFStream::read_u16().

boost::uint32_t gnash::IOChannel::read_le32 ( )

Read a 32-bit word from a little-endian stream. returning it as a native-endian word.

Throw IOException on error

References read_byte().

Referenced by read_float32(), and gnash::SWFStream::read_u32().

int gnash::IOChannel::read_string ( char *  dst,
int  max_length 
)

Read up to max_length characters, returns the number of characters read, or -1 if the string length is longer than max_length.

Stops at the first \0 character if it comes before max_length.

Guarantees termination of the string.

Returns:
the number of characters read, or -1 no null-termination was found within max_length

Throw IOException on error

References gnash::key::i, and read_byte().

virtual std::streamsize gnash::IOChannel::readNonBlocking ( void *  dst,
std::streamsize  num 
) [inline, virtual]

Read at most the given number of bytes w/out blocking.

Throw IOException on error

Returns:
The number of bytes actually read. A short count may mean EOF was hit or data didn't arrive yet.

Default implementation proxies the call to the blocking version.

Reimplemented in gnash::Socket.

virtual bool gnash::IOChannel::seek ( std::streampos  p) [pure virtual]

Seek to the specified position.

Throw IOException on error

Returns:
true on success, or false on failure.

Implemented in gnash::Socket.

Referenced by gnash::media::MediaHandler::isFLV(), gnash::SWFStream::seek(), and gnash::SWFStream::close_tag().

virtual size_t gnash::IOChannel::size ( ) const [inline, virtual]

Get the size of the stream (unreliably).

Size of stream is unreliable as not all input channels have a mechanism to advertise size, and some have one but isn't necessarely truthful (a few HTTP severs are bogus in this reguard).

Returns:
unreliable input size, (size_t)-1 if not known.
virtual std::streampos gnash::IOChannel::tell ( ) const [pure virtual]

Return current stream position.

Throw IOException on error

Implemented in gnash::Socket.

Referenced by gnash::SWFStream::tell().

std::streamsize gnash::IOChannel::write ( const void *  src,
std::streamsize  num 
) [virtual]

Write the given number of bytes to the stream.

Throw IOException on error/unsupported op.

Reimplemented in gnash::Socket.


The documentation for this class was generated from the following files: