<class name="QTemporaryFile" doc="/** <p>The <a href="QTemporaryFile.html#QTemporaryFile(java.lang.String)"><tt>QTemporaryFile</tt></a> class is an I/O device that operates on temporary files.</p> <p><a href="QTemporaryFile.html#QTemporaryFile(java.lang.String)"><tt>QTemporaryFile</tt></a> is used to create unique temporary files safely. The file itself is created by calling <a href="QTemporaryFile.html#open(com.trolltech.qt.core.QIODevice.OpenMode)"><tt>open</tt></a>. The name of the temporary file is guaranteed to be unique (i.e&#x2e;, you are guaranteed to not overwrite an existing file), and the file will subsequently be removed upon destruction of the <a href="QTemporaryFile.html#QTemporaryFile(java.lang.String)"><tt>QTemporaryFile</tt></a> object. This is an important technique that avoids data corruption for applications that store data in temporary files. The file name is either auto-generated, or created based on a template, which is passed to <a href="QTemporaryFile.html#QTemporaryFile(java.lang.String)"><tt>QTemporaryFile</tt></a>'s constructor.</p> <p>Example:</p> <pre> { QTemporaryFile file; if (file.open()) { <span class="comment">// file.fileName() returns the unique file name</span> } <span class="comment">// the QTemporaryFile destructor removes the temporary file</span> }</pre> <p>Reopening a <a href="QTemporaryFile.html#QTemporaryFile(java.lang.String)"><tt>QTemporaryFile</tt></a> after calling <a href="QFile.html#close()"><tt>close</tt></a> is safe. For as long as the <a href="QTemporaryFile.html#QTemporaryFile(java.lang.String)"><tt>QTemporaryFile</tt></a> object itself is not destroyed, the unique temporary file will exist and be kept open internally by <a href="QTemporaryFile.html#QTemporaryFile(java.lang.String)"><tt>QTemporaryFile</tt></a>.</p> <p>A temporary file will have some static part of the name and some part that is calculated to be unique. The default filename qt_temp will be placed into the temporary path as returned by QDir::tempPath().</p> @see <tt>QDir::tempPath</tt> @see <a href="QFile.html#QFile(com.trolltech.qt.core.QObject)"><tt>QFile</tt></a> */"> <signal name="protected final void aboutToClose()" doc="/** <p>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&#x2e;, if you have data in a separate buffer that needs to be written to the device).</p> <dl> <dt><b>Compatible Slot Signature:</b></dt> <dd><tt>void mySlot()</tt></dd> </dl> */"/> <signal name="protected final void bytesWritten(long bytes)" doc="/** <p>This signal is emitted every time a payload of data has been written to the device. The <tt>bytes</tt> argument is set to the number of bytes that were written in this payload.</p> <p><a href="QTemporaryFile.html#bytesWritten(long)"><tt>bytesWritten</tt></a> is not emitted recursively; if you reenter the event loop or call <a href="QIODevice.html#waitForBytesWritten(int)"><tt>waitForBytesWritten</tt></a> inside a slot connected to the <a href="QTemporaryFile.html#bytesWritten(long)"><tt>bytesWritten</tt></a> signal, the signal will not be reemitted (although <a href="QIODevice.html#waitForBytesWritten(int)"><tt>waitForBytesWritten</tt></a> may still return true).</p> <dl> <dt><b>Compatible Slot Signatures:</b></dt> <dd><tt>void mySlot(long bytes)</tt></dd> <dd><tt>void mySlot()</tt></dd> </dl> <dl> <dt><b>See Also:</b></dt> <dd><a href="QTemporaryFile.html#readyRead()"><tt>readyRead</tt></a></dd> </dl> */"/> <signal name="protected final void readyRead()" doc="/** <p>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.</p> <p><a href="QTemporaryFile.html#readyRead()"><tt>readyRead</tt></a> is not emitted recursively; if you reenter the event loop or call <a href="QIODevice.html#waitForReadyRead(int)"><tt>waitForReadyRead</tt></a> inside a slot connected to the <a href="QTemporaryFile.html#readyRead()"><tt>readyRead</tt></a> signal, the signal will not be reemitted (although <a href="QIODevice.html#waitForReadyRead(int)"><tt>waitForReadyRead</tt></a> may still return true).</p> <dl> <dt><b>Compatible Slot Signature:</b></dt> <dd><tt>void mySlot()</tt></dd> </dl> <dl> <dt><b>See Also:</b></dt> <dd><a href="QTemporaryFile.html#bytesWritten(long)"><tt>bytesWritten</tt></a></dd> </dl> */"/> <method name="public QTemporaryFile()" doc="/** <p>Constructs a <a href="QTemporaryFile.html#QTemporaryFile(java.lang.String)"><tt>QTemporaryFile</tt></a> in QDir::tempPath(), using the file template &quot;qt_temp.XXXXXX&quot;. The file is stored in the system's temporary directory.</p> @see <a href="QTemporaryFile.html#setFileTemplate(java.lang.String)"><tt>setFileTemplate</tt></a> @see <tt>QDir::tempPath</tt> */"/> <method name="public QTemporaryFile(com.trolltech.qt.core.QObject parent)" doc="/** <p>Constructs a <a href="QTemporaryFile.html#QTemporaryFile(java.lang.String)"><tt>QTemporaryFile</tt></a> (with the given <tt>parent</tt>) in QDir::tempPath(), using the file template &quot;qt_temp.XXXXXX&quot;.</p> @see <a href="QTemporaryFile.html#setFileTemplate(java.lang.String)"><tt>setFileTemplate</tt></a> */"/> <method name="public QTemporaryFile(java.lang.String templateName, com.trolltech.qt.core.QObject parent)" doc="/** <p>Constructs a <a href="QTemporaryFile.html#QTemporaryFile(java.lang.String)"><tt>QTemporaryFile</tt></a> with a template filename of <tt>templateName</tt> and the specified <tt>parent</tt>. Upon opening the temporary file this will be used to create a unique filename. If the <tt>templateName</tt> does end in XXXXXX it will automatically be appended and used as the dynamic portion of the filename.</p> <p>If <tt>templateName</tt> is a relative path, the path will be relative to the current working directory. You can use QDir::tempPath() to construct <tt>templateName</tt> if you want use the system's temporary directory.</p> @see <a href="QTemporaryFile.html#open(com.trolltech.qt.core.QIODevice.OpenMode)"><tt>open</tt></a> @see <a href="QTemporaryFile.html#fileTemplate()"><tt>fileTemplate</tt></a> */"/> <method name="public QTemporaryFile(java.lang.String templateName)" doc="/** <p>Constructs a <a href="QTemporaryFile.html#QTemporaryFile(java.lang.String)"><tt>QTemporaryFile</tt></a> with a template filename of <tt>templateName</tt>. Upon opening the temporary file this will be used to create a unique filename. If the <tt>templateName</tt> does not contain XXXXXX it will automatically be appended and used as the dynamic portion of the filename.</p> <p>If <tt>templateName</tt> is a relative path, the path will be relative to the current working directory. You can use QDir::tempPath() to construct <tt>templateName</tt> if you want use the system's temporary directory.</p> @see <a href="QTemporaryFile.html#open(com.trolltech.qt.core.QIODevice.OpenMode)"><tt>open</tt></a> @see <a href="QTemporaryFile.html#fileTemplate()"><tt>fileTemplate</tt></a> */"/> <method name="public final boolean autoRemove()" doc="/** <p>Returns true if the <a href="QTemporaryFile.html#QTemporaryFile(java.lang.String)"><tt>QTemporaryFile</tt></a> is in auto remove mode. Auto-remove mode will automatically delete the filename from disk upon destruction. This makes it very easy to create your <a href="QTemporaryFile.html#QTemporaryFile(java.lang.String)"><tt>QTemporaryFile</tt></a> object on the stack, fill it with data, read from it, and finally on function return it will automatically clean up after itself.</p> <p>Auto-remove is on by default.</p> @see <a href="QTemporaryFile.html#setAutoRemove(boolean)"><tt>setAutoRemove</tt></a> @see <a href="QFile.html#remove(java.lang.String)"><tt>remove</tt></a> */"/> <method name="public final java.lang.String uniqueFilename()" doc="/** <p>Returns the complete unique filename backing the <a href="QTemporaryFile.html#QTemporaryFile(java.lang.String)"><tt>QTemporaryFile</tt></a> object. This string is null before the <a href="QTemporaryFile.html#QTemporaryFile(java.lang.String)"><tt>QTemporaryFile</tt></a> is opened, afterwards it will contain the <a href="QTemporaryFile.html#fileTemplate()"><tt>fileTemplate</tt></a> plus additional characters to make it unique.</p> @see <a href="QTemporaryFile.html#fileTemplate()"><tt>fileTemplate</tt></a> */"/> <method name="public final java.lang.String fileTemplate()" doc="/** <p>Returns the set file template. The default file template will be called qt_temp and be placed in QDir::tempPath().</p> @see <a href="QTemporaryFile.html#setFileTemplate(java.lang.String)"><tt>setFileTemplate</tt></a> */"/> <method name="public final boolean open()" doc="/** <p>A <a href="QTemporaryFile.html#QTemporaryFile(java.lang.String)"><tt>QTemporaryFile</tt></a> will always be opened in QIODevice::ReadWrite mode, this allows easy access to the data in the file. This function will return true upon success and will set the <a href="QFile.html#fileName()"><tt>fileName</tt></a> to the unique filename used.</p> @see <a href="QFile.html#fileName()"><tt>fileName</tt></a> */"/> <method name="public final void setAutoRemove(boolean b)" doc="/** <p>Sets the <a href="QTemporaryFile.html#QTemporaryFile(java.lang.String)"><tt>QTemporaryFile</tt></a> into auto-remove mode if <tt>b</tt> is true.</p> <p>Auto-remove is on by default.</p> @see <a href="QTemporaryFile.html#autoRemove()"><tt>autoRemove</tt></a> @see <a href="QFile.html#remove(java.lang.String)"><tt>remove</tt></a> */"/> <method name="public final void setFileTemplate(java.lang.String name)" doc="/** <p>Sets the static portion of the file name to <tt>name</tt>. If the file template ends in XXXXXX that will automatically be replaced with the unique part of the filename, otherwise a filename will be determined automatically based on the static portion specified.</p> <p>If <tt>name</tt> contains a relative file path, the path will be relative to the current working directory. You can use QDir::tempPath() to construct <tt>name</tt> if you want use the system's temporary directory.</p> @see <a href="QTemporaryFile.html#fileTemplate()"><tt>fileTemplate</tt></a> */"/> <method name="public com.trolltech.qt.core.QAbstractFileEngine fileEngine()" doc="/** <p>This function is reimplemented for internal reasons.</p> */"/> <method name="public boolean open(com.trolltech.qt.core.QIODevice.OpenMode flags)" doc="/** <p>This function is reimplemented for internal reasons.</p> */"/> <method name="public static com.trolltech.qt.core.QTemporaryFile createLocalFile(com.trolltech.qt.core.QFile file)" doc="/** <p>Creates and returns a local temporary file whose contents are a copy of the contents of the given <tt>file</tt>.</p> */"/> <method name="public native static com.trolltech.qt.core.QTemporaryFile createLocalFile(java.lang.String fileName)" doc="/** <p>Works on the given <tt>fileName</tt> rather than an existing <a href="QFile.html#QFile(com.trolltech.qt.core.QObject)"><tt>QFile</tt></a> object.</p> */"/> </class>