KDE 4.2 PyKDE API Reference

- KDE's Python API

# Packet Class Reference

`from PyKDE4.phonon import *`

Namespace: Phonon

## Detailed Description

\class Packet packetpool.h Phonon/Packet Class to access memory preallocated by PacketPool

Note:
  PacketPool and Packet are threadsafe.

Author:
  Matthias Kretz <kretz@kde.org>

## Methods

| __init__ (self)
| __init__ (self, Phonon.PacketPool pool)
| __init__ (self, Phonon.Packet rhs)
| __init__ (self, PacketPrivate dd)
int | capacity (self)
QString | data (self)
QString | data (self)
bool | isNull (self)
bool | operator != (self, Phonon.Packet rhs)
bool | operator == (self, Phonon.Packet rhs)
| setSize (self, int size)
int | size (self)

## Method Documentation

__init__ | ( |  | self ) |

Constructs a null packet.

See also:
  isNull

__init__ | ( | self, |
|  | Phonon.PacketPool | pool
| ) |  |  |

Returns a packet with a capacity of pool.packetSize if there is still free data in the PacketPool. Returns a null packet otherwise. The size will initially be set to 0.

__init__ | ( | self, |
|  | Phonon.Packet | rhs
| ) |  |  |

Returns a shared copy of the object. Note that Packet will not detach (and it can not detach as there's a fixed amount of memory preallocated. If you want to copy the actual memory data you have to request another packet from the pool and copy the memory yourself.)

__init__ | ( | self, |
|  | PacketPrivate | dd
| ) |  |  |

int capacity | ( |  | self ) |

Returns the number of bytes that may be accessed.

QString data | ( |  | self ) |

Returns a pointer to read the data this packet references.

You may read size() bytes.

QString data | ( |  | self ) |

Returns a pointer to read and write the data this packet references.

You may read size() bytes. You may write capacity() bytes. If you write to this pointer do not forget to adjust the size by calling setSize().

bool isNull | ( |  | self ) |

Returns whether this object is a null packet.

See also:
  Packet()

bool operator != | ( | self, |
|  | Phonon.Packet | rhs
| ) |  |  |

Returns whether the packets reference different data.

bool operator == | ( | self, |
|  | Phonon.Packet | rhs
| ) |  |  |

Returns whether the packets reference the same data.

setSize | ( | self, |
|  | int | size
| ) |  |  |

Sets how many bytes in the data pointer have a defined value.

int size | ( |  | self ) |

Returns the number of bytes that have a defined value.