AbZip  1.0.0
Public Member Functions | List of all members
IOBuffer Class Reference

Provides a message buffer that can be used to read & write data across the network. More...

#include <iobuffer.h>

Public Member Functions

 IOBuffer ()
 construct a new, empty buffer:
 
 IOBuffer (int size)
 Construct a new buffer with a given size.
 
 IOBuffer (const QByteArray &baSeed)
 Construct a new buffer, but seed with the contents of a ByteArray.
 
void clear ()
 Clear the contents of the message:
 
int read (QIODevice *ioDevice, qint64 size)
 
bool hasData ()
 returns true if there is still data in the buffer to read
 
quint32 size () const
 get message size:
 
quint32 currentPosition ()
 
void seek (quint32 nPos)
 
const QByteArray & getByteArray () const
 get a copy of the message as a byte array:
 
quint8 readByte ()
 read a single byte. Modifies internal position:
 
void writeByte (quint8 n)
 Write a single byte.
 
quint32 readUInt32 ()
 reads a four byte unsigned integer from the message, and moves the current position one by 4 bytes.
 
void writeUInt32 (quint32 n)
 writes four bytes at the current position and moves the position forwards by 4 bytes.
 
quint64 readUInt64 ()
 reads a 8 byte unsigned long from the message, and moves the current position one by 4 bytes.
 
void writeUInt64 (quint64 n)
 writes 8 bytes at the current position and moves the position forwards by 8 bytes.
 
QByteArray readByteArray (quint32 size)
 reads a string of size length. Modifies position.
 
void writeByteArray (const QByteArray &ba)
 writes data size, then data (without nulls) to message. Modifies position.
 
void writeRawBytes (const QByteArray &ba)
 
void writeRawData (const void *data, int nLen)
 Write raw byte data to buffer.
 
quint16 readUInt16 ()
 Read an unsigned short:
 
void writeUInt16 (quint16 n)
 Write an unsigned short:
 
void pad (quint8 nNumBytes)
 Pad a certain number of empty (0) bytes:
 
void skip (quint8 nNumBytes)
 Skip a number of bytes - to be used with the pad() method above:
 

Detailed Description

Provides a message buffer that can be used to read & write data across the network.

Member Function Documentation

void IOBuffer::writeRawBytes ( const QByteArray &  ba)

Write some raw bytes to the buffer array. This can be used to concatenate two messages together. No syntax checking is done, so it's important that the source byte array comes from another net message buffer.


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