MoSync 3.0.1
MAUtil::DataHandler Class Reference

Facilitates consecutive reads and writes to a MoSync data object. More...

#include <MAUtil/DataHandler.h>

List of all members.

Public Member Functions

 DataHandler (MAHandle data)
bool read (void *dst, int len)
bool skip (int len)
void write (const void *src, int len)

Public Attributes

const int size

Detailed Description

Facilitates consecutive reads and writes to a MoSync data object.

Keeps a handle and a position.


Constructor & Destructor Documentation

Initializes DataHandler::size and sets the position to 0.


Member Function Documentation

bool MAUtil::DataHandler::read ( void *  dst,
int  len 
) [inline]

Copies len bytes from the data object to memory pointed to by dst.

Returns:
True on success. False if the operation could not be completed because there's not enough data left.
See also:
maReadData()

References maReadData(), and size.

bool MAUtil::DataHandler::skip ( int  len) [inline]

Moves the position forward len bytes.

Returns:
True on success. False if the operation could not be completed because the data object was too small.

References size.

void MAUtil::DataHandler::write ( const void *  src,
int  len 
) [inline]

Copies len bytes to the data object from memory pointed to by src.

See also:
maWriteData()

References maWriteData().


Member Data Documentation

The size, in bytes, of the data object.

Referenced by read(), and skip().

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines