⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 file.html

📁 API資料大全
💻 HTML
📖 第 1 页 / 共 5 页
字号:
<HR><A NAME="createNewFile()"><!-- --></A><H3>createNewFile</H3><PRE>public boolean <B>createNewFile</B>()                      throws <A HREF="../../java/io/IOException.html">IOException</A></PRE><DL><DD>Atomically creates a new, empty file named by this abstract pathname if and only if a file with this name does not yet exist.  The check for the existence of the file and the creation of the file if it does not exist are a single operation that is atomic with respect to all other filesystem activities that might affect the file.  This method, in combination with the <code><A HREF="../../java/io/File.html#deleteOnExit()"><CODE>deleteOnExit()</CODE></A></code> method, can therefore serve as the basis for a simple but reliable cooperative file-locking protocol.<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD><code>true</code> if the named file does not exist and was          successfully created; <code>false</code> if the named file          already exists<DT><B>Throws:</B><DD><CODE><A HREF="../../java/io/IOException.html">IOException</A></CODE> - If an I/O error occurred<DD><CODE><A HREF="../../java/lang/SecurityException.html">SecurityException</A></CODE> - If a security manager exists and its <code><A HREF="../../java/lang/SecurityManager.html#checkWrite(java.io.FileDescriptor)"><CODE>SecurityManager.checkWrite(java.io.FileDescriptor)</CODE></A></code> method denies          write access to the file<DT><B>Since: </B><DD>1.2</DD></DL></DD></DL><HR><A NAME="delete()"><!-- --></A><H3>delete</H3><PRE>public boolean <B>delete</B>()</PRE><DL><DD>Deletes the file or directory denoted by this abstract pathname.  If this pathname denotes a directory, then the directory must be empty in order to be deleted.<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD><code>true</code> if and only if the file or directory is          successfully deleted; <code>false</code> otherwise<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/SecurityException.html">SecurityException</A></CODE> - If a security manager exists and its <code><A HREF="../../java/lang/SecurityManager.html#checkDelete(java.lang.String)"><CODE>SecurityManager.checkDelete(java.lang.String)</CODE></A></code> method denies          delete access to the file</DL></DD></DL><HR><A NAME="deleteOnExit()"><!-- --></A><H3>deleteOnExit</H3><PRE>public void <B>deleteOnExit</B>()</PRE><DL><DD>Requests that the file or directory denoted by this abstract pathname be deleted when the virtual machine terminates.  Deletion will be attempted only for normal termination of the virtual machine, as defined by the Java Language Specification (12.9). <p> Once deletion has been requested, it is not possible to cancel the request.  This method should therefore be used with care.<DD><DL></DL></DD><DD><DL><DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/SecurityException.html">SecurityException</A></CODE> - If a security manager exists and its <code><A HREF="../../java/lang/SecurityManager.html#checkDelete(java.lang.String)"><CODE>SecurityManager.checkDelete(java.lang.String)</CODE></A></code> method denies          delete access to the file<DT><B>Since: </B><DD>1.2</DD><DT><B>See Also: </B><DD><A HREF="../../java/io/File.html#delete()"><CODE>delete()</CODE></A></DL></DD></DL><HR><A NAME="list()"><!-- --></A><H3>list</H3><PRE>public <A HREF="../../java/lang/String.html">String</A>[] <B>list</B>()</PRE><DL><DD>Returns an array of strings naming the files and directories in the directory denoted by this abstract pathname. <p> If this abstract pathname does not denote a directory, then this method returns <code>null</code>.  Otherwise an array of strings is returned, one for each file or directory in the directory.  Names denoting the directory itself and the directory's parent directory are not included in the result.  Each string is a file name rather than a complete path. <p> There is no guarantee that the name strings in the resulting array will appear in any specific order; they are not, in particular, guaranteed to appear in alphabetical order.<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>An array of strings naming the files and directories in the          directory denoted by this abstract pathname.  The array will be          empty if the directory is empty.  Returns <code>null</code> if          this abstract pathname does not denote a directory, or if an          I/O error occurs.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/SecurityException.html">SecurityException</A></CODE> - If a security manager exists and its <code><A HREF="../../java/lang/SecurityManager.html#checkRead(java.io.FileDescriptor)"><CODE>SecurityManager.checkRead(java.io.FileDescriptor)</CODE></A></code> method denies          read access to the directory</DL></DD></DL><HR><A NAME="list(java.io.FilenameFilter)"><!-- --></A><H3>list</H3><PRE>public <A HREF="../../java/lang/String.html">String</A>[] <B>list</B>(<A HREF="../../java/io/FilenameFilter.html">FilenameFilter</A>&nbsp;filter)</PRE><DL><DD>Returns an array of strings naming the files and directories in the directory denoted by this abstract pathname that satisfy the specified filter.  The behavior of this method is the same as that of the <code><A HREF="../../java/io/File.html#list()"><CODE>list()</CODE></A></code> method, except that the strings in the returned array must satisfy the filter.  If the given <code>filter</code> is <code>null</code> then all names are accepted. Otherwise, a name satisfies the filter if and only if the value <code>true</code> results when the <code><A HREF="../../java/io/FilenameFilter.html#accept(java.io.File, java.lang.String)"><CODE>FilenameFilter.accept(java.io.File, java.lang.String)</CODE></A></code> method of the filter is invoked on this abstract pathname and the name of a file or directory in the directory that it denotes.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>filter</CODE> - A filename filter<DT><B>Returns:</B><DD>An array of strings naming the files and directories in the          directory denoted by this abstract pathname that were accepted          by the given <code>filter</code>.  The array will be empty if          the directory is empty or if no names were accepted by the          filter.  Returns <code>null</code> if this abstract pathname          does not denote a directory, or if an I/O error occurs.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/SecurityException.html">SecurityException</A></CODE> - If a security manager exists and its <code><A HREF="../../java/lang/SecurityManager.html#checkRead(java.io.FileDescriptor)"><CODE>SecurityManager.checkRead(java.io.FileDescriptor)</CODE></A></code> method denies          read access to the directory</DL></DD></DL><HR><A NAME="listFiles()"><!-- --></A><H3>listFiles</H3><PRE>public <A HREF="../../java/io/File.html">File</A>[] <B>listFiles</B>()</PRE><DL><DD>Returns an array of abstract pathnames denoting the files in the directory denoted by this abstract pathname. <p> If this abstract pathname does not denote a directory, then this method returns <code>null</code>.  Otherwise an array of <code>File</code> objects is returned, one for each file or directory in the directory.  Pathnames denoting the directory itself and the directory's parent directory are not included in the result.  Each resulting abstract pathname is constructed from this abstract pathname using the <code><A HREF="../../java/io/File.html#File(java.io.File, java.lang.String)"><CODE>File(File,&nbsp;String)</CODE></A></code> constructor.  Therefore if this pathname is absolute then each resulting pathname is absolute; if this pathname is relative then each resulting pathname will be relative to the same directory. <p> There is no guarantee that the name strings in the resulting array will appear in any specific order; they are not, in particular, guaranteed to appear in alphabetical order.<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>An array of abstract pathnames denoting the files and          directories in the directory denoted by this abstract          pathname.  The array will be empty if the directory is          empty.  Returns <code>null</code> if this abstract pathname          does not denote a directory, or if an I/O error occurs.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/SecurityException.html">SecurityException</A></CODE> - If a security manager exists and its <code><A HREF="../../java/lang/SecurityManager.html#checkRead(java.io.FileDescriptor)"><CODE>SecurityManager.checkRead(java.io.FileDescriptor)</CODE></A></code> method denies          read access to the directory<DT><B>Since: </B><DD>1.2</DD></DL></DD></DL><HR><A NAME="listFiles(java.io.FilenameFilter)"><!-- --></A><H3>listFiles</H3><PRE>public <A HREF="../../java/io/File.html">File</A>[] <B>listFiles</B>(<A HREF="../../java/io/FilenameFilter.html">FilenameFilter</A>&nbsp;filter)</PRE><DL><DD>Returns an array of abstract pathnames denoting the files and directories in the directory denoted by this abstract pathname that satisfy the specified filter.  The behavior of this method is the same as that of the <code><A HREF="../../java/io/File.html#listFiles()"><CODE>listFiles()</CODE></A></code> method, except that the pathnames in the returned array must satisfy the filter. If the given <code>filter</code> is <code>null</code> then all pathnames are accepted.  Otherwise, a pathname satisfies the filter if and only if the value <code>true</code> results when the <code><A HREF="../../java/io/FilenameFilter.html#accept(java.io.File, java.lang.String)"><CODE>FilenameFilter.accept(java.io.File, java.lang.String)</CODE></A></code> method of the filter is invoked on this abstract pathname and the name of a file or directory in the directory that it denotes.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>filter</CODE> - A filename filter<DT><B>Returns:</B><DD>An array of abstract pathnames denoting the files and          directories in the directory denoted by this abstract          pathname.  The array will be empty if the directory is          empty.  Returns <code>null</code> if this abstract pathname          does not denote a directory, or if an I/O error occurs.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/SecurityException.html">SecurityException</A></CODE> - If a security manager exists and its <code><A HREF="../../java/lang/SecurityManager.html#checkRead(java.io.FileDescriptor)"><CODE>SecurityManager.checkRead(java.io.FileDescriptor)</CODE></A></code> method denies          read access to the directory<DT><B>Since: </B><DD>1.2</DD></DL></DD></DL><HR><A NAME="listFiles(java.io.FileFilter)"><!-- --></A><H3>listFiles</H3><PRE>public <A HREF="../../java/io/File.html">File</A>[] <B>listFiles</B>(<A HREF="../../java/io/FileFilter.html">FileFilter</A>&nbsp;filter)</PRE><DL><DD>Returns an array of abstract pathnames denoting the files and directories in the directory denoted by this abstract pathname that satisfy the specified filter.  The behavior of this method is the same as that of the <code><A HREF="../../java/io/File.html#listFiles()"><CODE>listFiles()</CODE></A></code> method, except that the pathnames in the returned array must satisfy the filter. If the given <code>filter</code> is <code>null</code> then all pathnames are accepted.  Otherwise, a pathname satisfies the filter if and only if the value <code>true</code> results when the <code><A HREF="../../java/io/FilenameFilter.html#accept(java.io.File, java.lang.String)"><CODE>FilenameFilter.accept(java.io.File, java.lang.String)</CODE></A></code> method of the filter is invoked on the pathname.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>filter</CODE> - A filename filter<DT><B>Returns:</B><DD>An array of abstract pathnames denoting the files and          directories in the directory denoted by this abstract          pathname.  The array will be empty if the directory is          empty.  Returns <code>null</code> if this abstract pathname          does not denote a directory, or if an I/O error occurs.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/SecurityException.html">SecurityException</A></CODE> - If a security manager exists and its <code><A HREF="../../java/lang/SecurityManager.html#checkRead(java.io.FileDescriptor)"><CODE>SecurityManager.checkRead(java.io.FileDescriptor)</CODE></A></code> method denies          read access to the directory<DT><B>Since: </B><DD>1.2</DD></DL></DD></DL><HR><A NAME="mkdir()"><!-- --></A><H3>mkdir</H3><PRE>public boolean <B>mkdir</B>()</PRE><DL><DD>Creates the directory named by this abstract pathname.<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD><code>true</code> if and only if the directory was          created; <code>false</code> otherwise<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/SecurityException.html">SecurityException</A></CODE> - If a security manager exists and its <code><A HREF="../../java/lang/SecurityManager.html#checkWrite(java.io.FileDescriptor)"><CODE>SecurityManager.checkWrite(java.io.FileDescriptor)</CODE></A></code> method does not          permit the named directory to be created</DL></DD></DL><HR><A NAME="mkdirs()"><!-- --></A><H3>mkdirs</H3><PRE>public boolean <B>mkdirs</B>()</PRE><DL><DD>Creates the directory named by this abstract pathname, including any necessary but nonexistent parent directories.  Note that if this operation fails it may have succeeded in creating some of the necessary parent directories.<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD><code>true</code> if and only if the directory was created,          along with all necessary parent directories; <code>false</code>          otherwise<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/SecurityException.html">SecurityException</A></CODE> - If a security manager exists and its <code><A HREF="../../java/lang/SecurityManager.html#checkWrite(java.io.FileDescriptor)"><CODE>SecurityManager.checkWrite(java.io.FileDescriptor)</CODE></A></code> method does not          permit the named directory and all necessary parent directories          and to be created</DL></DD></DL><HR><A NAME="renameTo(java.io.File)"><!-- --></A><H3>renameTo</H3><PRE>public boolean <B>renameTo</B>(<A HREF="../../java/io/File.html">File</A>&nbsp;dest)</PRE><DL><DD>Renames the file denoted by this abstract pathname.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>dest</CODE> - The new abstract pathname for the named file<DT><B>Returns:</B><DD><code>true</code> if and only if the renaming succeeded;          <code>false</code> otherwise<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/SecurityException.html">SecurityExceptio

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -