<class name="QFile" doc="/** <p>The <a href="QFile.html#QFile(com.trolltech.qt.core.QObject)"><tt>QFile</tt></a> class provides an interface for reading from and writing to files.</p> <p><a href="QFile.html#QFile(com.trolltech.qt.core.QObject)"><tt>QFile</tt></a> is an I/O device for reading and writing text and binary files and <a href="%2E%2E/resources.html">resources</tt></a>. A <a href="QFile.html#QFile(com.trolltech.qt.core.QObject)"><tt>QFile</tt></a> may be used by itself or, more conveniently, with a <a href="QTextStream.html"><tt>QTextStream</tt></a> or <a href="QDataStream.html"><tt>QDataStream</tt></a>.</p> <p>The file name is usually passed in the constructor, but it can be set at any time using <a href="QFile.html#setFileName(java.lang.String)"><tt>setFileName</tt></a>. You can check for a file's existence using <a href="QFile.html#exists(java.lang.String)"><tt>exists</tt></a>, and remove a file using <a href="QFile.html#remove(java.lang.String)"><tt>remove</tt></a>. (More advanced file system related operations are provided by <a href="QFileInfo.html"><tt>QFileInfo</tt></a> and <a href="QDir.html"><tt>QDir</tt></a>.)</p> <p>The file is opened with <a href="QFile.html#open(com.trolltech.qt.core.QIODevice.OpenMode)"><tt>open</tt></a>, closed with <a href="QFile.html#close()"><tt>close</tt></a>, and flushed with <a href="QFile.html#flush()"><tt>flush</tt></a>. Data is usually read and written using <a href="QDataStream.html"><tt>QDataStream</tt></a> or <a href="QTextStream.html"><tt>QTextStream</tt></a>, but you can also call the <a href="QIODevice.html#QIODevice(com.trolltech.qt.core.QObject)"><tt>QIODevice</tt></a>-inherited functions <a href="QIODevice.html#read(long)"><tt>read</tt></a>, <a href="QIODevice.html#readLine(long)"><tt>readLine</tt></a>, <a href="QIODevice.html#readAll()"><tt>readAll</tt></a>, <a href="QIODevice.html#write(com.trolltech.qt.core.QByteArray)"><tt>write</tt></a>. <a href="QFile.html#QFile(com.trolltech.qt.core.QObject)"><tt>QFile</tt></a> also inherits getChar(), putChar(), and ungetChar(), which work one character at a time.</p> <p>The size of the file is returned by <a href="QFile.html#size()"><tt>size</tt></a>. You can get the current file position using <a href="QFile.html#pos()"><tt>pos</tt></a>, or move to a new file position using <a href="QFile.html#seek(long)"><tt>seek</tt></a>. If you've reached the end of the file, <a href="QFile.html#atEnd()"><tt>atEnd</tt></a> returns true.</p> <a name="reading-files-directly"></a> <h3>Reading Files Directly</h3> <p>The following example reads a text file line by line:</p> <pre> QFile file(&quot;in.txt&quot;); if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) return; while (!file.atEnd()) { QByteArray line = file.readLine(); process_line(line); }</pre> <p>The QIODevice::Text flag passed to <a href="QFile.html#open(com.trolltech.qt.core.QIODevice.OpenMode)"><tt>open</tt></a> tells Qt to convert Windows-style line terminators (&quot;\r\n&quot;) into C++-style terminators (&quot;\n&quot;). By default, <a href="QFile.html#QFile(com.trolltech.qt.core.QObject)"><tt>QFile</tt></a> assumes binary, i.e&#x2e; it doesn't perform any conversion on the bytes stored in the file.</p> <a name="using-streams-to-read-files"></a> <h3>Using Streams to Read Files</h3> <p>The next example uses <a href="QTextStream.html"><tt>QTextStream</tt></a> to read a text file line by line:</p> <pre> QFile file(&quot;in.txt&quot;); if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) return; QTextStream in(&amp;file); while (!in.atEnd()) { QString line = in.readLine(); process_line(line); }</pre> <p><a href="QTextStream.html"><tt>QTextStream</tt></a> takes care of converting the 8-bit data stored on disk into a 16-bit Unicode <a href="%2E%2E/porting4.html#qstring"><tt>QString</tt></a>. By default, it assumes that the user system's local 8-bit encoding is used (e.g&#x2e;, ISO 8859-1 for most of Europe; see QTextCodec::codecForLocale() for details). This can be changed using setCodec().</p> <p>To write text, we can use operator&lt;&lt;(), which is overloaded to take a <a href="QTextStream.html"><tt>QTextStream</tt></a> on the left and various data types (including <a href="%2E%2E/porting4.html#qstring"><tt>QString</tt></a>) on the right:</p> <pre> QFile file(&quot;out.txt&quot;); if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) return; QTextStream out(&amp;file); out &lt;&lt; &quot;The magic number is: &quot; &lt;&lt; 49 &lt;&lt; &quot;\n&quot;;</pre> <p><a href="QDataStream.html"><tt>QDataStream</tt></a> is similar, in that you can use operator&lt;&lt;() to write data and operator&gt;&gt;() to read it back. See the class documentation for details.</p> <p>When you use <a href="QFile.html#QFile(com.trolltech.qt.core.QObject)"><tt>QFile</tt></a>, <a href="QFileInfo.html"><tt>QFileInfo</tt></a>, and <a href="QDir.html"><tt>QDir</tt></a> to access the file system with Qt, you can use Unicode file names. On Unix, these file names are converted to an 8-bit encoding. If you want to use standard C++ APIs (<tt>&lt;cstdio&gt;</tt> or <tt>&lt;iostream&gt;</tt>) or platform-specific APIs to access files instead of <a href="QFile.html#QFile(com.trolltech.qt.core.QObject)"><tt>QFile</tt></a>, you can use the <a href="QFile.html#encodeName(java.lang.String)"><tt>encodeName</tt></a> and <a href="QFile.html#decodeName(com.trolltech.qt.core.QByteArray)"><tt>decodeName</tt></a> functions to convert between Unicode file names and 8-bit file names.</p> <p>On Unix, there are some special system files (e.g&#x2e; in <tt>/proc</tt>) for which <a href="QFile.html#size()"><tt>size</tt></a> will always return 0, yet you may still be able to read more data from such a file; the data is generated in direct response to you calling <a href="QIODevice.html#read(long)"><tt>read</tt></a>. In this case, however, you cannot use <a href="QFile.html#atEnd()"><tt>atEnd</tt></a> to determine if there is more data to read (since <a href="QFile.html#atEnd()"><tt>atEnd</tt></a> will return true for a file that claims to have size 0). Instead, you should either call <a href="QIODevice.html#readAll()"><tt>readAll</tt></a>, or call <a href="QIODevice.html#read(long)"><tt>read</tt></a> or <a href="QIODevice.html#readLine(long)"><tt>readLine</tt></a> repeatedly until no more data can be read. The next example uses <a href="QTextStream.html"><tt>QTextStream</tt></a> to read <tt>/proc/modules</tt> line by line:</p> <pre> QFile file(&quot;/proc/modules&quot;); if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) return; QTextStream in(&amp;file); QString line = in.readLine(); while (!line.isNull()) { process_line(line); line = in.readLine(); }</pre> <a name="signals"></a> <h3>Signals</h3> <p>Unlike other <a href="QIODevice.html#QIODevice(com.trolltech.qt.core.QObject)"><tt>QIODevice</tt></a> implementations, such as <a href="%2E%2E/network/QTcpSocket.html"><tt>QTcpSocket</tt></a>, <a href="QFile.html#QFile(com.trolltech.qt.core.QObject)"><tt>QFile</tt></a> does not emit the <a href="QFile.html#aboutToClose()"><tt>aboutToClose</tt></a>, <a href="QFile.html#bytesWritten(long)"><tt>bytesWritten</tt></a>, or <a href="QFile.html#readyRead()"><tt>readyRead</tt></a> signals. This implementation detail means that <a href="QFile.html#QFile(com.trolltech.qt.core.QObject)"><tt>QFile</tt></a> is not suitable for reading and writing certain types of files, such as device files on Unix platforms.</p> @see <a href="QTextStream.html"><tt>QTextStream</tt></a> @see <a href="QDataStream.html"><tt>QDataStream</tt></a> @see <a href="QFileInfo.html"><tt>QFileInfo</tt></a> @see <a href="QDir.html"><tt>QDir</tt></a> @see <a href="%2E%2E/resources.html">The Qt Resource System</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="QFile.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="QFile.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="QFile.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="QFile.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="QFile.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="QFile.html#bytesWritten(long)"><tt>bytesWritten</tt></a></dd> </dl> */"/> <method name="public QFile(java.lang.String name, com.trolltech.qt.core.QObject parent)" doc="/** <p>Constructs a new file object with the given <tt>parent</tt> to represent the file with the specified <tt>name</tt>.</p> */"/> <method name="public QFile(java.lang.String name)" doc="/** <p>Constructs a new file object to represent the file with the given <tt>name</tt>.</p> */"/> <method name="public QFile()" doc="/** <p>This method is used internally by Qt Jambi. Do not use it in your applications.</p> */"/> <method name="public QFile(com.trolltech.qt.core.QObject parent)" doc="/** <p>Constructs a new file object with the given <tt>parent</tt>.</p> */"/> <method name="public final boolean copy(java.lang.String newName)" doc="/** <p>Copies the file currently specified by <a href="QFile.html#fileName()"><tt>fileName</tt></a> to a file called <tt>newName</tt>. Returns true if successful; otherwise returns false.</p> <p>Note that if a file with the name <tt>newName</tt> already exists, <a href="QFile.html#copy(java.lang.String, java.lang.String)"><tt>copy</tt></a> returns false (i.e&#x2e; <a href="QFile.html#QFile(com.trolltech.qt.core.QObject)"><tt>QFile</tt></a> will not overwrite it).</p> <p>The source file is closed before it is copied.</p> @see <a href="QFile.html#setFileName(java.lang.String)"><tt>setFileName</tt></a> */"/> <method name="public final com.trolltech.qt.core.QFile.FileError error()" doc="/** <p>Returns the file error status.</p> <p>The I/O device status returns an error code. For example, if <a href="QFile.html#open(com.trolltech.qt.core.QIODevice.OpenMode)"><tt>open</tt></a> returns false, or a read/write operation returns -1, this function can be called to find out the reason why the operation failed.</p> @see <a href="QFile.html#unsetError()"><tt>unsetError</tt></a> */"/> <method name="public final boolean exists()" doc="/** <p>Returns true if the file specified by <a href="QFile.html#fileName()"><tt>fileName</tt></a> exists; otherwise returns false.</p> @see <a href="QFile.html#fileName()"><tt>fileName</tt></a> @see <a href="QFile.html#setFileName(java.lang.String)"><tt>setFileName</tt></a> */"/> <method name="public final java.lang.String fileName()" doc="/** <p>Returns the name set by <a href="QFile.html#setFileName(java.lang.String)"><tt>setFileName</tt></a>.</p> @see <a href="QFile.html#setFileName(java.lang.String)"><tt>setFileName</tt></a> @see <tt>QFileInfo::fileName</tt> */"/> <method name="public final boolean flush()" doc="/** <p>Flushes any buffered data to the file. Returns true if successful; otherwise returns false.</p> */"/> <method name="public final int handle()" doc="/** <p>Returns the file handle of the file.</p> <p>This is a small positive integer, suitable for use with C library functions such as fdopen() and fcntl(). On systems that use file descriptors for sockets (i.e&#x2e; Unix systems, but not Windows) the handle can be used with <a href="QSocketNotifier.html"><tt>QSocketNotifier</tt></a> as well.</p> <p>If the file is not open, or there is an error, <a href="QFile.html#handle()"><tt>handle</tt></a> returns -1.</p> @see <a href="QSocketNotifier.html"><tt>QSocketNotifier</tt></a> */"/> <method name="public final boolean link(java.lang.String newName)" doc="/** <p>Creates a link named <tt>newName</tt> that points to the file currently specified by <a href="QFile.html#fileName()"><tt>fileName</tt></a>. What a link is depends on the underlying filesystem (be it a shortcut on Windows or a symbolic link on Unix). Returns true if successful; otherwise returns false.</p> <p><b>Note:</b> To create a valid link on Windows, <tt>newName</tt> must have a <tt>.lnk</tt> file extension.</p> @see <a href="QFile.html#setFileName(java.lang.String)"><tt>setFileName</tt></a> */"/> <method name="public final boolean open(int fd, com.trolltech.qt.core.QIODevice.OpenMode flags)" doc="/** <p>Opens the existing file descripter <tt>fd</tt> in the given <tt>flags</tt>. Returns true if successful; otherwise returns false.</p> <p>When a <a href="QFile.html#QFile(com.trolltech.qt.core.QObject)"><tt>QFile</tt></a> is opened using this function, <a href="QFile.html#close()"><tt>close</tt></a> does not actually close the file.</p> <p>The <a href="QFile.html#QFile(com.trolltech.qt.core.QObject)"><tt>QFile</tt></a> that is opened using this function is automatically set to be in raw mode; this means that the file input/output functions are slow. If you run into performance issues, you should try to use one of the other open functions.</p> <p><b>Warning:</b> If <tt>fd</tt> is 0 (<tt>stdin</tt>), 1 (<tt>stdout</tt>), or 2 (<tt>stderr</tt>), you may not be able to <a href="QFile.html#seek(long)"><tt>seek</tt></a>. <a href="QFile.html#size()"><tt>size</tt></a> is set to <tt>LLONG_MAX</tt> (in <tt>&lt;climits&gt;</tt>).</p> @see <a href="QFile.html#close()"><tt>close</tt></a> */"/> <method name="public final com.trolltech.qt.core.QFile.Permissions permissions()" doc="/** <p>Returns the complete OR-ed together combination of QFile::Permission for the file.</p> @see <a href="QFile.html#setPermissions(java.lang.String, com.trolltech.qt.core.QFile.Permissions)"><tt>setPermissions</tt></a> @see <a href="QFile.html#setFileName(java.lang.String)"><tt>setFileName</tt></a> */"/> <method name="public final boolean remove()" doc="/** <p>Removes the file specified by <a href="QFile.html#fileName()"><tt>fileName</tt></a>. Returns true if successful; otherwise returns false.</p> <p>The file is closed before it is removed.</p> @see <a href="QFile.html#setFileName(java.lang.String)"><tt>setFileName</tt></a> */"/> <method name="public final boolean rename(java.lang.String newName)" doc="/** <p>Renames the file currently specified by <a href="QFile.html#fileName()"><tt>fileName</tt></a> to <tt>newName</tt>. Returns true if successful; otherwise returns false.</p> <p>If a file with the name <tt>newName</tt> already exists, <a href="QFile.html#rename(java.lang.String, java.lang.String)"><tt>rename</tt></a> returns false (i.e&#x2e;, <a href="QFile.html#QFile(com.trolltech.qt.core.QObject)"><tt>QFile</tt></a> will not overwrite it).</p> <p>The file is closed before it is renamed.</p> @see <a href="QFile.html#setFileName(java.lang.String)"><tt>setFileName</tt></a> */"/> <method name="public final boolean resize(long sz)" doc="/** <p>Sets the file size (in bytes) <tt>sz</tt>. Returns true if the file if the resize succeeds; false otherwise. If <tt>sz</tt> is larger than the file currently is the new bytes will be set to 0, if <tt>sz</tt> is smaller the file is simply truncated.</p> @see <a href="QFile.html#size()"><tt>size</tt></a> @see <a href="QFile.html#setFileName(java.lang.String)"><tt>setFileName</tt></a> */"/> <method name="public final void setFileName(java.lang.String name)" doc="/** <p>Sets the <tt>name</tt> of the file. The name can have no path, a relative path, or an absolute path.</p> <p>Do not call this function if the file has already been opened.</p> <p>If the file name has no path or a relative path, the path used will be the application's current directory path <i>at the time of the <a href="QFile.html#open(com.trolltech.qt.core.QIODevice.OpenMode)"><tt>open</tt></a></i> call.</p> <p>Example:</p> <pre> QFile file; QDir::setCurrent(&quot;/tmp&quot;); file.setFileName(&quot;readme.txt&quot;); QDir::setCurrent(&quot;/home&quot;); file.open(QIODevice::ReadOnly); <span class="comment">// opens &quot;/home/readme.txt&quot; under Unix</span></pre> <p>Note that the directory separator &quot;/&quot; works for all operating systems supported by Qt.</p> @see <a href="QFile.html#fileName()"><tt>fileName</tt></a> @see <a href="QFileInfo.html"><tt>QFileInfo</tt></a> @see <a href="QDir.html"><tt>QDir</tt></a> */"/> <method name="public final boolean setPermissions(com.trolltech.qt.core.QFile.Permissions permissionSpec)" doc="/** <p>Sets the permissions for the file to the <tt>permissionSpec</tt> specified. Returns true if successful, or false if the permissions cannot be modified.</p> @see <a href="QFile.html#permissions(java.lang.String)"><tt>permissions</tt></a> @see <a href="QFile.html#setFileName(java.lang.String)"><tt>setFileName</tt></a> */"/> <method name="public final java.lang.String symLinkTarget()" doc="/** <p>Returns the absolute path of the file or directory a symlink (or shortcut on Windows) points to, or a an empty string if the object isn't a symbolic link.</p> <p>This name may not represent an existing file; it is only a string. QFile::exists() returns true if the symlink points to an existing file.</p> @see <a href="QFile.html#fileName()"><tt>fileName</tt></a> @see <a href="QFile.html#setFileName(java.lang.String)"><tt>setFileName</tt></a> */"/> <method name="public final void unsetError()" doc="/** <p>Sets the file's error to QFile::NoError.</p> @see <a href="QFile.html#error()"><tt>error</tt></a> */"/> <method name="public boolean atEnd()" doc="/** <p>Returns true if the end of the file has been reached; otherwise returns false.</p> <p>For regular empty files on Unix (e.g&#x2e; those in <tt>/proc</tt>), this function returns true, since the file system reports that the size of such a file is 0. Therefore, you should not depend on <a href="QFile.html#atEnd()"><tt>atEnd</tt></a> when reading data from such a file, but rather call <a href="QIODevice.html#read(long)"><tt>read</tt></a> until no more data can be read.</p> */"/> <method name="public void close()" doc="/** <p>This function is reimplemented for internal reasons.</p> */"/> <method name="public com.trolltech.qt.core.QAbstractFileEngine fileEngine()" doc="/** <p>This method is used internally by Qt Jambi. Do not use it in your applications.</p> */"/> <method name="public boolean isSequential()" doc="/** <p>Returns true if the file can only be manipulated sequentially; otherwise returns false.</p> <p>Most files support random-access, but some special files may not.</p> @see <tt>QIODevice::isSequential</tt> */"/> <method name="public boolean open(com.trolltech.qt.core.QIODevice.OpenMode flags)" doc="/** <p>Opens the file using OpenMode <tt>flags</tt>, returning true if successful; otherwise false.</p> <p>The <tt>flags</tt> must be QIODevice::ReadOnly, QIODevice::WriteOnly, or QIODevice::ReadWrite. It may also have additional flags, such as QIODevice::Text and QIODevice::Unbuffered.</p> <p><b>Note:</b> In WriteOnly or ReadWrite mode, if the relevant file does not already exist, this function will try to create a new file before opening it.</p> <p><b>Note:</b> Because of limitations in the native API, <a href="QFile.html#QFile(com.trolltech.qt.core.QObject)"><tt>QFile</tt></a> ignores the Unbuffered flag on Windows.</p> @see <tt>QIODevice::OpenMode</tt> @see <a href="QFile.html#setFileName(java.lang.String)"><tt>setFileName</tt></a> */"/> <method name="public long pos()" doc="/** <p>This function is reimplemented for internal reasons.</p> */"/> <method name="protected int readData(byte[] data)" doc="/** <p>Equivalent to <a href="QFile.html#readData(byte[])"><tt>readData</tt></a>(<tt>data</tt>, ). */"/> <method name="protected int readLineData(byte[] data)" doc="/** <p>Equivalent to <a href="QFile.html#readLineData(byte[])"><tt>readLineData</tt></a>(<tt>data</tt>, ). */"/> <method name="public boolean seek(long offset)" doc="/** <p>For random-access devices, this function sets the current position to <tt>offset</tt>, returning true on success, or false if an error occurred. For sequential devices, the default behavior is to do nothing and return false.</p> <p>When subclassing <a href="QIODevice.html#QIODevice(com.trolltech.qt.core.QObject)"><tt>QIODevice</tt></a>, you must call QIODevice::seek() at the start of your function to ensure integrity with <a href="QIODevice.html#QIODevice(com.trolltech.qt.core.QObject)"><tt>QIODevice</tt></a>'s built-in buffer. The base implementation always returns true.</p> @see <a href="QFile.html#pos()"><tt>pos</tt></a> @see <a href="QFile.html#isSequential()"><tt>isSequential</tt></a> */"/> <method name="public long size()" doc="/** <p>Returns the size of the file.</p> <p>For regular empty files on Unix (e.g&#x2e; those in <tt>/proc</tt>), this function returns 0; the contents of such a file are generated on demand in response to you calling <a href="QIODevice.html#read(long)"><tt>read</tt></a>.</p> */"/> <method name="protected int writeData(byte[] data)" doc="/** <p>Equivalent to <a href="QFile.html#writeData(byte[])"><tt>writeData</tt></a>(<tt>data</tt>, ). */"/> <method name="public native static boolean copy(java.lang.String fileName, java.lang.String newName)" doc="/** <p>Copies the file <tt>fileName</tt> to <tt>newName</tt>. Returns true if successful; otherwise returns false.</p> <p>If a file with the name <tt>newName</tt> already exists, <a href="QFile.html#copy(java.lang.String, java.lang.String)"><tt>copy</tt></a> returns false (i.e&#x2e;, <a href="QFile.html#QFile(com.trolltech.qt.core.QObject)"><tt>QFile</tt></a> will not overwrite it).</p> @see <a href="QFile.html#rename(java.lang.String, java.lang.String)"><tt>rename</tt></a> */"/> <method name="public static java.lang.String decodeName(com.trolltech.qt.core.QByteArray localFileName)" doc="/** <p>This does the reverse of QFile::encodeName() using <tt>localFileName</tt>.</p> @see <tt>setDecodingFunction</tt> @see <a href="QFile.html#encodeName(java.lang.String)"><tt>encodeName</tt></a> */"/> <method name="public native static com.trolltech.qt.core.QByteArray encodeName(java.lang.String fileName)" doc="/** <p>By default, this function converts <tt>fileName</tt> to the local 8-bit encoding determined by the user's locale. This is sufficient for file names that the user chooses. File names hard-coded into the application should only use 7-bit ASCII filename characters.</p> @see <a href="QFile.html#decodeName(com.trolltech.qt.core.QByteArray)"><tt>decodeName</tt></a> @see <tt>setEncodingFunction</tt> */"/> <method name="public native static boolean exists(java.lang.String fileName)" doc="/** <p>Returns true if the file specified by <tt>fileName</tt> exists; otherwise returns false.</p> */"/> <method name="public native static boolean link(java.lang.String oldname, java.lang.String newName)" doc="/** <p>Creates a link named <tt>newName</tt> that points to the file <tt>oldname</tt>. What a link is depends on the underlying filesystem (be it a shortcut on Windows or a symbolic link on Unix). Returns true if successful; otherwise returns false.</p> @see <a href="QFile.html#link(java.lang.String, java.lang.String)"><tt>link</tt></a> */"/> <method name="public static com.trolltech.qt.core.QFile.Permissions permissions(java.lang.String filename)" doc="/** <p>Returns the complete OR-ed together combination of QFile::Permission for <tt>filename</tt>.</p> @see <a href="QFile.html#setPermissions(java.lang.String, com.trolltech.qt.core.QFile.Permissions)"><tt>setPermissions</tt></a> */"/> <method name="public native static boolean remove(java.lang.String fileName)" doc="/** <p>Removes the file specified by the <tt>fileName</tt> given.</p> <p>Returns true if successful; otherwise returns false.</p> @see <a href="QFile.html#remove(java.lang.String)"><tt>remove</tt></a> */"/> <method name="public native static boolean rename(java.lang.String oldName, java.lang.String newName)" doc="/** <p>Renames the file <tt>oldName</tt> to <tt>newName</tt>. Returns true if successful; otherwise returns false.</p> <p>If a file with the name <tt>newName</tt> already exists, <a href="QFile.html#rename(java.lang.String, java.lang.String)"><tt>rename</tt></a> returns false (i.e&#x2e;, <a href="QFile.html#QFile(com.trolltech.qt.core.QObject)"><tt>QFile</tt></a> will not overwrite it).</p> @see <a href="QFile.html#rename(java.lang.String, java.lang.String)"><tt>rename</tt></a> */"/> <method name="public native static boolean resize(java.lang.String filename, long sz)" doc="/** <p>Sets <tt>filename</tt> to size (in bytes) <tt>sz</tt>. Returns true if the file if the resize succeeds; false otherwise. If <tt>sz</tt> is larger than <tt>filename</tt> currently is the new bytes will be set to 0, if <tt>sz</tt> is smaller the file is simply truncated.</p> @see <a href="QFile.html#resize(java.lang.String, long)"><tt>resize</tt></a> */"/> <method name="public static boolean setPermissions(java.lang.String filename, com.trolltech.qt.core.QFile.Permissions permissionSpec)" doc="/** <p>Sets the permissions for <tt>filename</tt> file to <tt>permissionSpec</tt>.</p> @see <a href="QFile.html#permissions(java.lang.String)"><tt>permissions</tt></a> */"/> <method name="public native static java.lang.String symLinkTarget(java.lang.String fileName)" doc="/** <p>Returns the absolute path of the file or directory referred to by the symlink (or shortcut on Windows) specified by <tt>fileName</tt>, or returns an empty string if the <tt>fileName</tt> does not correspond to a symbolic link.</p> <p>This name may not represent an existing file; it is only a string. QFile::exists() returns true if the symlink points to an existing file.</p> */"/> <enum name="FileError" doc="/** <p>This enum describes the errors that may be returned by the <a href="QFile.html#error()"><tt>error</tt></a> function.</p> */"> <enum-value name="NoError" doc="/** <p>No error occurred.</p> */"/> <enum-value name="ReadError" doc="/** <p>An error occurred when reading from the file.</p> */"/> <enum-value name="WriteError" doc="/** <p>An error occurred when writing to the file.</p> */"/> <enum-value name="FatalError" doc="/** <p>A fatal error occurred.</p> */"/> <enum-value name="ResourceError" doc="/** Internal. */"/> <enum-value name="OpenError" doc="/** <p>The file could not be opened.</p> */"/> <enum-value name="AbortError" doc="/** <p>The operation was aborted.</p> */"/> <enum-value name="TimeOutError" doc="/** <p>A timeout occurred.</p> */"/> <enum-value name="UnspecifiedError" doc="/** <p>An unspecified error occurred.</p> */"/> <enum-value name="RemoveError" doc="/** <p>The file could not be removed.</p> */"/> <enum-value name="RenameError" doc="/** <p>The file could not be renamed.</p> */"/> <enum-value name="PositionError" doc="/** <p>The position in the file could not be changed.</p> */"/> <enum-value name="ResizeError" doc="/** <p>The file could not be resized.</p> */"/> <enum-value name="PermissionsError" doc="/** <p>The file could not be accessed.</p> */"/> <enum-value name="CopyError" doc="/** <p>The file could not be copied.</p> */"/> </enum> <enum name="Permission" doc="/** <p>This enum is used by the permission() function to report the permissions and ownership of a file. The values may be OR-ed together to test multiple permissions and ownership values.</p> <p><b>Warning:</b> Because of differences in the platforms supported by Qt, the semantics of <a href="QFile.html#Permission-enum"><tt>ReadUser</tt></a>, <a href="QFile.html#Permission-enum"><tt>WriteUser</tt></a> and <a href="QFile.html#Permission-enum"><tt>ExeUser</tt></a> are platform-dependent: On Unix, the rights of the owner of the file are returned and on Windows the rights of the current user are returned. This behavior might change in a future Qt version.</p> */"> <enum-value name="ReadOwner" doc="/** <p>The file is readable by the owner of the file.</p> */"/> <enum-value name="WriteOwner" doc="/** <p>The file is writable by the owner of the file.</p> */"/> <enum-value name="ExeOwner" doc="/** <p>The file is executable by the owner of the file.</p> */"/> <enum-value name="ReadUser" doc="/** <p>The file is readable by the user.</p> */"/> <enum-value name="WriteUser" doc="/** <p>The file is writable by the user.</p> */"/> <enum-value name="ExeUser" doc="/** <p>The file is executable by the user.</p> */"/> <enum-value name="ReadGroup" doc="/** <p>The file is readable by the group.</p> */"/> <enum-value name="WriteGroup" doc="/** <p>The file is writable by the group.</p> */"/> <enum-value name="ExeGroup" doc="/** <p>The file is executable by the group.</p> */"/> <enum-value name="ReadOther" doc="/** <p>The file is readable by anyone.</p> */"/> <enum-value name="WriteOther" doc="/** <p>The file is writable by anyone.</p> */"/> <enum-value name="ExeOther" doc="/** <p>The file is executable by anyone.</p> */"/> </enum> </class>