Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > a6711891ce757817bba854bf3f25205a > files > 1932

qtjambi-doc-4.3.3-3mdv2008.1.i586.rpm

<class name="QBuffer" doc="/**
&lt;p&gt;The &lt;a href=&quot;QBuffer.html#QBuffer(com.trolltech.qt.core.QObject)&quot;&gt;&lt;tt&gt;QBuffer&lt;/tt&gt;&lt;/a&gt; class provides a &lt;a href=&quot;QIODevice.html#QIODevice(com.trolltech.qt.core.QObject)&quot;&gt;&lt;tt&gt;QIODevice&lt;/tt&gt;&lt;/a&gt; interface for a &lt;a href=&quot;QByteArray.html&quot;&gt;&lt;tt&gt;QByteArray&lt;/tt&gt;&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;QBuffer.html#QBuffer(com.trolltech.qt.core.QObject)&quot;&gt;&lt;tt&gt;QBuffer&lt;/tt&gt;&lt;/a&gt; allows you to access a &lt;a href=&quot;QByteArray.html&quot;&gt;&lt;tt&gt;QByteArray&lt;/tt&gt;&lt;/a&gt; using the &lt;a href=&quot;QIODevice.html#QIODevice(com.trolltech.qt.core.QObject)&quot;&gt;&lt;tt&gt;QIODevice&lt;/tt&gt;&lt;/a&gt; interface. The &lt;a href=&quot;QByteArray.html&quot;&gt;&lt;tt&gt;QByteArray&lt;/tt&gt;&lt;/a&gt; is treated just as a standard random-accessed file. Example:&lt;/p&gt;
&lt;pre&gt;        QBuffer buffer;
        char ch;

        buffer.open(QBuffer::ReadWrite);
        buffer.write(&amp;quot;Qt rocks!&amp;quot;);
        buffer.seek(0);
        buffer.getChar(&amp;amp;ch);  &lt;span class=&quot;comment&quot;&gt;// ch == 'Q'&lt;/span&gt;
        buffer.getChar(&amp;amp;ch);  &lt;span class=&quot;comment&quot;&gt;// ch == 't'&lt;/span&gt;
        buffer.getChar(&amp;amp;ch);  &lt;span class=&quot;comment&quot;&gt;// ch == ' '&lt;/span&gt;
        buffer.getChar(&amp;amp;ch);  &lt;span class=&quot;comment&quot;&gt;// ch == 'r'&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;By default, an internal &lt;a href=&quot;QByteArray.html&quot;&gt;&lt;tt&gt;QByteArray&lt;/tt&gt;&lt;/a&gt; buffer is created for you when you create a &lt;a href=&quot;QBuffer.html#QBuffer(com.trolltech.qt.core.QObject)&quot;&gt;&lt;tt&gt;QBuffer&lt;/tt&gt;&lt;/a&gt;. You can access this buffer directly by calling &lt;a href=&quot;QBuffer.html#buffer()&quot;&gt;&lt;tt&gt;buffer&lt;/tt&gt;&lt;/a&gt;. You can also use &lt;a href=&quot;QBuffer.html#QBuffer(com.trolltech.qt.core.QObject)&quot;&gt;&lt;tt&gt;QBuffer&lt;/tt&gt;&lt;/a&gt; with an existing &lt;a href=&quot;QByteArray.html&quot;&gt;&lt;tt&gt;QByteArray&lt;/tt&gt;&lt;/a&gt; by calling setBuffer(), or by passing your array to &lt;a href=&quot;QBuffer.html#QBuffer(com.trolltech.qt.core.QObject)&quot;&gt;&lt;tt&gt;QBuffer&lt;/tt&gt;&lt;/a&gt;'s constructor.&lt;/p&gt;
&lt;p&gt;Call &lt;a href=&quot;QBuffer.html#open(com.trolltech.qt.core.QIODevice.OpenMode)&quot;&gt;&lt;tt&gt;open&lt;/tt&gt;&lt;/a&gt; to open the buffer. Then call &lt;a href=&quot;QIODevice.html#write(com.trolltech.qt.core.QByteArray)&quot;&gt;&lt;tt&gt;write&lt;/tt&gt;&lt;/a&gt; or putChar() to write to the buffer, and &lt;a href=&quot;QIODevice.html#read(long)&quot;&gt;&lt;tt&gt;read&lt;/tt&gt;&lt;/a&gt;, &lt;a href=&quot;QIODevice.html#readLine(long)&quot;&gt;&lt;tt&gt;readLine&lt;/tt&gt;&lt;/a&gt;, &lt;a href=&quot;QIODevice.html#readAll()&quot;&gt;&lt;tt&gt;readAll&lt;/tt&gt;&lt;/a&gt;, or getChar() to read from it. &lt;a href=&quot;QBuffer.html#size()&quot;&gt;&lt;tt&gt;size&lt;/tt&gt;&lt;/a&gt; returns the current size of the buffer, and you can seek to arbitrary positions in the buffer by calling &lt;a href=&quot;QBuffer.html#seek(long)&quot;&gt;&lt;tt&gt;seek&lt;/tt&gt;&lt;/a&gt;. When you are done with accessing the buffer, call &lt;a href=&quot;QBuffer.html#close()&quot;&gt;&lt;tt&gt;close&lt;/tt&gt;&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The following code snippet shows how to write data to a &lt;a href=&quot;QByteArray.html&quot;&gt;&lt;tt&gt;QByteArray&lt;/tt&gt;&lt;/a&gt; using &lt;a href=&quot;QDataStream.html&quot;&gt;&lt;tt&gt;QDataStream&lt;/tt&gt;&lt;/a&gt; and &lt;a href=&quot;QBuffer.html#QBuffer(com.trolltech.qt.core.QObject)&quot;&gt;&lt;tt&gt;QBuffer&lt;/tt&gt;&lt;/a&gt;:&lt;/p&gt;
&lt;pre&gt;        QByteArray byteArray;
        QBuffer buffer(&amp;amp;byteArray);
        buffer.open(QIODevice::WriteOnly);

        QDataStream out(&amp;amp;buffer);
        out &amp;lt;&amp;lt; QApplication::palette();&lt;/pre&gt;
&lt;p&gt;Effectively, we convert the application's &lt;a href=&quot;%2E%2E/gui/QPalette.html&quot;&gt;&lt;tt&gt;QPalette&lt;/tt&gt;&lt;/a&gt; into a byte array. Here's how to read the data from the &lt;a href=&quot;QByteArray.html&quot;&gt;&lt;tt&gt;QByteArray&lt;/tt&gt;&lt;/a&gt;:&lt;/p&gt;
&lt;pre&gt;        QPalette palette;
        QBuffer buffer(&amp;amp;byteArray);
        buffer.open(QIODevice::ReadOnly);

        QDataStream in(&amp;amp;buffer);
        in &amp;gt;&amp;gt; palette;&lt;/pre&gt;
&lt;p&gt;&lt;a href=&quot;QTextStream.html&quot;&gt;&lt;tt&gt;QTextStream&lt;/tt&gt;&lt;/a&gt; and &lt;a href=&quot;QDataStream.html&quot;&gt;&lt;tt&gt;QDataStream&lt;/tt&gt;&lt;/a&gt; also provide convenience constructors that take a &lt;a href=&quot;QByteArray.html&quot;&gt;&lt;tt&gt;QByteArray&lt;/tt&gt;&lt;/a&gt; and that create a &lt;a href=&quot;QBuffer.html#QBuffer(com.trolltech.qt.core.QObject)&quot;&gt;&lt;tt&gt;QBuffer&lt;/tt&gt;&lt;/a&gt; behind the scenes.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;QBuffer.html#QBuffer(com.trolltech.qt.core.QObject)&quot;&gt;&lt;tt&gt;QBuffer&lt;/tt&gt;&lt;/a&gt; emits &lt;a href=&quot;QBuffer.html#readyRead()&quot;&gt;&lt;tt&gt;readyRead&lt;/tt&gt;&lt;/a&gt; when new data has arrived in the buffer. By connecting to this signal, you can use &lt;a href=&quot;QBuffer.html#QBuffer(com.trolltech.qt.core.QObject)&quot;&gt;&lt;tt&gt;QBuffer&lt;/tt&gt;&lt;/a&gt; to store temporary data before processing it. For example, you can pass the buffer to &lt;a href=&quot;%2E%2E/network/QFtp.html&quot;&gt;&lt;tt&gt;QFtp&lt;/tt&gt;&lt;/a&gt; when downloading a file from an FTP server. Whenever a new payload of data has been downloaded, &lt;a href=&quot;QBuffer.html#readyRead()&quot;&gt;&lt;tt&gt;readyRead&lt;/tt&gt;&lt;/a&gt; is emitted, and you can process the data that just arrived. &lt;a href=&quot;QBuffer.html#QBuffer(com.trolltech.qt.core.QObject)&quot;&gt;&lt;tt&gt;QBuffer&lt;/tt&gt;&lt;/a&gt; also emits &lt;a href=&quot;QBuffer.html#bytesWritten(long)&quot;&gt;&lt;tt&gt;bytesWritten&lt;/tt&gt;&lt;/a&gt; every time new data has been written to the buffer.&lt;/p&gt;

@see &lt;a href=&quot;QFile.html&quot;&gt;&lt;tt&gt;QFile&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QDataStream.html&quot;&gt;&lt;tt&gt;QDataStream&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QTextStream.html&quot;&gt;&lt;tt&gt;QTextStream&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QByteArray.html&quot;&gt;&lt;tt&gt;QByteArray&lt;/tt&gt;&lt;/a&gt; */">
    <signal name="protected final void aboutToClose()" doc="/**
&lt;p&gt;This signal is emitted when the device is about to close. Connect this signal if you have operations that need to be performed before the device closes (e.g&amp;#x2e;, if you have data in a separate buffer that needs to be written to the device).&lt;/p&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;b&gt;Compatible Slot Signature:&lt;/b&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;tt&gt;void mySlot()&lt;/tt&gt;&lt;/dd&gt;
&lt;/dl&gt;
 */"/>
    <signal name="protected final void bytesWritten(long bytes)" doc="/**
&lt;p&gt;This signal is emitted every time a payload of data has been written to the device. The &lt;tt&gt;bytes&lt;/tt&gt; argument is set to the number of bytes that were written in this payload.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;QBuffer.html#bytesWritten(long)&quot;&gt;&lt;tt&gt;bytesWritten&lt;/tt&gt;&lt;/a&gt; is not emitted recursively; if you reenter the event loop or call &lt;a href=&quot;QIODevice.html#waitForBytesWritten(int)&quot;&gt;&lt;tt&gt;waitForBytesWritten&lt;/tt&gt;&lt;/a&gt; inside a slot connected to the &lt;a href=&quot;QBuffer.html#bytesWritten(long)&quot;&gt;&lt;tt&gt;bytesWritten&lt;/tt&gt;&lt;/a&gt; signal, the signal will not be reemitted (although &lt;a href=&quot;QIODevice.html#waitForBytesWritten(int)&quot;&gt;&lt;tt&gt;waitForBytesWritten&lt;/tt&gt;&lt;/a&gt; may still return true).&lt;/p&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;b&gt;Compatible Slot Signatures:&lt;/b&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;tt&gt;void mySlot(long bytes)&lt;/tt&gt;&lt;/dd&gt;
&lt;dd&gt;&lt;tt&gt;void mySlot()&lt;/tt&gt;&lt;/dd&gt;
&lt;/dl&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;b&gt;See Also:&lt;/b&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;a href=&quot;QBuffer.html#readyRead()&quot;&gt;&lt;tt&gt;readyRead&lt;/tt&gt;&lt;/a&gt;&lt;/dd&gt;
&lt;/dl&gt;
 */"/>
    <signal name="protected final void readyRead()" doc="/**
&lt;p&gt;This signal is emitted once every time new data is available for reading from the device. It will only be emitted again once new data is available, such as when a new payload of network data has arrived on your network socket, or when a new block of data has been appended to your device.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;QBuffer.html#readyRead()&quot;&gt;&lt;tt&gt;readyRead&lt;/tt&gt;&lt;/a&gt; is not emitted recursively; if you reenter the event loop or call &lt;a href=&quot;QIODevice.html#waitForReadyRead(int)&quot;&gt;&lt;tt&gt;waitForReadyRead&lt;/tt&gt;&lt;/a&gt; inside a slot connected to the &lt;a href=&quot;QBuffer.html#readyRead()&quot;&gt;&lt;tt&gt;readyRead&lt;/tt&gt;&lt;/a&gt; signal, the signal will not be reemitted (although &lt;a href=&quot;QIODevice.html#waitForReadyRead(int)&quot;&gt;&lt;tt&gt;waitForReadyRead&lt;/tt&gt;&lt;/a&gt; may still return true).&lt;/p&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;b&gt;Compatible Slot Signature:&lt;/b&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;tt&gt;void mySlot()&lt;/tt&gt;&lt;/dd&gt;
&lt;/dl&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;b&gt;See Also:&lt;/b&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;a href=&quot;QBuffer.html#bytesWritten(long)&quot;&gt;&lt;tt&gt;bytesWritten&lt;/tt&gt;&lt;/a&gt;&lt;/dd&gt;
&lt;/dl&gt;
 */"/>
    <method name="public QBuffer(com.trolltech.qt.core.QObject parent)" doc="/**
&lt;p&gt;Constructs an empty buffer with the given &lt;tt&gt;parent&lt;/tt&gt;. You can call &lt;a href=&quot;QBuffer.html#setData(com.trolltech.qt.core.QByteArray)&quot;&gt;&lt;tt&gt;setData&lt;/tt&gt;&lt;/a&gt; to fill the buffer with data, or you can open it in write mode and use &lt;a href=&quot;QIODevice.html#write(com.trolltech.qt.core.QByteArray)&quot;&gt;&lt;tt&gt;write&lt;/tt&gt;&lt;/a&gt;.&lt;/p&gt;

@see &lt;a href=&quot;QBuffer.html#open(com.trolltech.qt.core.QIODevice.OpenMode)&quot;&gt;&lt;tt&gt;open&lt;/tt&gt;&lt;/a&gt; */"/>
    <method name="public QBuffer()" doc="/**
&lt;p&gt;Equivalent to &lt;a href=&quot;QBuffer.html#QBuffer(com.trolltech.qt.core.QObject)&quot;&gt;&lt;tt&gt;QBuffer&lt;/tt&gt;&lt;/a&gt;(0). */"/>
    <method name="public final com.trolltech.qt.core.QByteArray buffer()" doc="/**
&lt;p&gt;This is the same as &lt;a href=&quot;QBuffer.html#data()&quot;&gt;&lt;tt&gt;data&lt;/tt&gt;&lt;/a&gt;.&lt;/p&gt;
 */"/>
    <method name="public final com.trolltech.qt.core.QByteArray data()" doc="/**
&lt;p&gt;Returns the data contained in the buffer.&lt;/p&gt;
&lt;p&gt;This is the same as &lt;a href=&quot;QBuffer.html#buffer()&quot;&gt;&lt;tt&gt;buffer&lt;/tt&gt;&lt;/a&gt;.&lt;/p&gt;

@see &lt;a href=&quot;QBuffer.html#setData(com.trolltech.qt.core.QByteArray)&quot;&gt;&lt;tt&gt;setData&lt;/tt&gt;&lt;/a&gt;
@see &lt;tt&gt;setBuffer&lt;/tt&gt; */"/>
    <method name="public final void setData(com.trolltech.qt.core.QByteArray data)" doc="/**
&lt;p&gt;Sets the contents of the internal buffer to be &lt;tt&gt;data&lt;/tt&gt;. This is the same as assigning &lt;tt&gt;data&lt;/tt&gt; to &lt;a href=&quot;QBuffer.html#buffer()&quot;&gt;&lt;tt&gt;buffer&lt;/tt&gt;&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Does nothing if &lt;a href=&quot;QIODevice.html#isOpen()&quot;&gt;&lt;tt&gt;isOpen&lt;/tt&gt;&lt;/a&gt; is true.&lt;/p&gt;

@see &lt;a href=&quot;QBuffer.html#data()&quot;&gt;&lt;tt&gt;data&lt;/tt&gt;&lt;/a&gt;
@see &lt;tt&gt;setBuffer&lt;/tt&gt; */"/>
    <method name="public boolean atEnd()" doc="/**
&lt;p&gt;This function is reimplemented for internal reasons.&lt;/p&gt;
 */"/>
    <method name="public boolean canReadLine()" doc="/**
&lt;p&gt;This function is reimplemented for internal reasons.&lt;/p&gt;
 */"/>
    <method name="public void close()" doc="/**
&lt;p&gt;This function is reimplemented for internal reasons.&lt;/p&gt;
 */"/>
    <method name="public boolean open(com.trolltech.qt.core.QIODevice.OpenMode openMode)" doc="/**
&lt;p&gt;Opens the device and sets its OpenMode to &lt;tt&gt;openMode&lt;/tt&gt;. Returns true if successful; otherwise returns false.&lt;/p&gt;

@see &lt;a href=&quot;QIODevice.html#openMode()&quot;&gt;&lt;tt&gt;openMode&lt;/tt&gt;&lt;/a&gt;
@see &lt;tt&gt;OpenMode&lt;/tt&gt; */"/>
    <method name="public long pos()" doc="/**
&lt;p&gt;This function is reimplemented for internal reasons.&lt;/p&gt;
 */"/>
    <method name="protected int readData(byte[] data)" doc="/**
&lt;p&gt;Equivalent to &lt;a href=&quot;QBuffer.html#readData(byte[])&quot;&gt;&lt;tt&gt;readData&lt;/tt&gt;&lt;/a&gt;(&lt;tt&gt;data&lt;/tt&gt;, ). */"/>
    <method name="public boolean seek(long off)" doc="/**
&lt;p&gt;For random-access devices, this function sets the current position to &lt;tt&gt;off&lt;/tt&gt;, returning true on success, or false if an error occurred. For sequential devices, the default behavior is to do nothing and return false.&lt;/p&gt;
&lt;p&gt;When subclassing &lt;a href=&quot;QIODevice.html#QIODevice(com.trolltech.qt.core.QObject)&quot;&gt;&lt;tt&gt;QIODevice&lt;/tt&gt;&lt;/a&gt;, you must call QIODevice::seek() at the start of your function to ensure integrity with &lt;a href=&quot;QIODevice.html#QIODevice(com.trolltech.qt.core.QObject)&quot;&gt;&lt;tt&gt;QIODevice&lt;/tt&gt;&lt;/a&gt;'s built-in buffer. The base implementation always returns true.&lt;/p&gt;

@see &lt;a href=&quot;QBuffer.html#pos()&quot;&gt;&lt;tt&gt;pos&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QIODevice.html#isSequential()&quot;&gt;&lt;tt&gt;isSequential&lt;/tt&gt;&lt;/a&gt; */"/>
    <method name="public long size()" doc="/**
&lt;p&gt;This function is reimplemented for internal reasons.&lt;/p&gt;
 */"/>
    <method name="protected int writeData(byte[] data)" doc="/**
&lt;p&gt;Equivalent to &lt;a href=&quot;QBuffer.html#writeData(byte[])&quot;&gt;&lt;tt&gt;writeData&lt;/tt&gt;&lt;/a&gt;(&lt;tt&gt;data&lt;/tt&gt;, ). */"/>
</class>