📄 fileconnection.html
字号:
public void <B>setWritable</B>(boolean writable)
throws java.io.IOException</PRE>
<DL>
<DD>
Sets the selected file or directory writable attribute to the indicated value.
The writable attribute for the file on the actual file system is set
immediately upon invocation of the method. If the file system doesn't support a
settable write attribute, this method is ignored and <code>canWrite()</code> always
returns true.
<P></P>
<DD>
<DL>
</DL>
<DD>
<DL>
<DT><B>Parameters:</B><DD><CODE>writable</CODE> - The new state of the writable flag of
the selected file. <DT><B>Throws:</B>
<DD>
<CODE>java.io.IOException</CODE> - if the connection's target does not exist or
is not accessible.
<DD>
<CODE><A HREF="../../../../javax/microedition/io/file/ConnectionClosedException.html">ConnectionClosedException</A></CODE>
- if the connection is closed.
<DD>
<CODE>java.lang.SecurityException</CODE> - if the security of the application
does not have write access to the connection's target.
<DD>
<CODE><A HREF="../../../../javax/microedition/io/file/IllegalModeException.html">IllegalModeException</A></CODE>
- if the application does have write access to the connection's target but has
opened the connection in <code>Connector.READ</code> mode.<DT><B>See Also:</B><DD><A HREF="../../../../javax/microedition/io/file/FileConnection.html#canWrite()"><CODE>canWrite()</CODE></A></DD></DL>
</DD>
</DL>
<HR>
<A NAME="setHidden(boolean)"><!-- --></A><H3>
setHidden</H3>
<PRE>
public void <B>setHidden</B>(boolean hidden)
throws java.io.IOException</PRE>
<DL>
<DD>
Sets the hidden attribute of the selected file to the value provided. The
attribute is applied to the file on the actual file system immediately upon
invocation of this method if the file system and platform support it. If the
file system doesn't support a hidden attribute, this method is ignored and <code>isHidden()</code>
always returns false. Since the exact definition of hidden is system-dependent,
this method only works on file systems that support a settable file attribute.
For example, on Win32 and FAT file systems, a file may be considered hidden if
it has been marked as such in the file's attributes; therefore this method is
applicable. However on UNIX systems a file may be considered to be hidden if
its name begins with a period character ('.'). In the UNIX case, this method
may be ignored and the method to make a file hidden may be the <code>rename()</code>
method.
<P></P>
<DD>
<DL>
</DL>
<DD>
<DL>
<DT><B>Parameters:</B><DD><CODE>hidden</CODE> - The new state of the hidden flag of the
selected file. <DT><B>Throws:</B>
<DD>
<CODE>java.io.IOException</CODE> - if the connection's target does not exist or
is not accessible.
<DD>
<CODE><A HREF="../../../../javax/microedition/io/file/ConnectionClosedException.html">ConnectionClosedException</A></CODE>
- if the connection is closed.
<DD>
<CODE>java.lang.SecurityException</CODE> - if the security of the application
does not have write access to the connection's target.
<DD>
<CODE><A HREF="../../../../javax/microedition/io/file/IllegalModeException.html">IllegalModeException</A></CODE>
- if the application does have write access to the connection's target but has
opened the connection in <code>Connector.READ</code> mode.<DT><B>See Also:</B><DD><A HREF="../../../../javax/microedition/io/file/FileConnection.html#isHidden()"><CODE>isHidden()</CODE></A></DD></DL>
</DD>
</DL>
<HR>
<A NAME="list()"><!-- --></A><H3>
list</H3>
<PRE>
public java.util.Enumeration <B>list</B>()
throws java.io.IOException</PRE>
<DL>
<DD>
Gets a list of all visible files and directories contained in a directory. The
directory is the connection's target as specified in <code>Connector.open()</code>.
<P></P>
<DD>
<DL>
</DL>
<DD>
<DL>
<DT><B>Returns:</B><DD>An Enumeration of strings, denoting the files and directories in
the directory. The string returned contain only the file or directory name and
does not contain any path prefix (to get a complete path for each file or
directory, prepend <A HREF="../../../../javax/microedition/io/file/FileConnection.html#getPath()">
<CODE>getPath()</CODE></A>). Directories are denoted with a trailing slash
"/" in their returned name. The Enumeration has zero length if the directory is
empty. Any hidden files and directories in the directory are not included in
the returned list. Any current directory indication (".") and any parent
directory indication ("..") is not included in the list of files and
directories returned. <DT><B>Throws:</B>
<DD>
<CODE>java.io.IOException</CODE> - if invoked on a file, the directory does not
exist, the directory is not accessible, or an I/O error occurs.
<DD>
<CODE><A HREF="../../../../javax/microedition/io/file/ConnectionClosedException.html">ConnectionClosedException</A></CODE>
- if the connection is closed.
<DD>
<CODE>java.lang.SecurityException</CODE> - if the security of the application
does not have read access for the directory.
<DD>
<CODE><A HREF="../../../../javax/microedition/io/file/IllegalModeException.html">IllegalModeException</A></CODE>
- if the application does have read access to the directory but has opened the
connection in <code>Connector.WRITE</code> mode.</DD></DL>
</DD>
</DL>
<HR>
<A NAME="list(java.lang.String, boolean)"><!-- --></A><H3>
list</H3>
<PRE>
public java.util.Enumeration <B>list</B>(java.lang.String filter,
boolean includeHidden)
throws java.io.IOException</PRE>
<DL>
<DD>
Gets a filtered list of files and directories contained in a directory. The
directory is the connection's target as specified in <code>Connector.open()</code>.
<P></P>
<DD>
<DL>
</DL>
<DD>
<DL>
<DT><B>Parameters:</B><DD><CODE>filter</CODE> - String against which all files and
directories are matched for retrieval. An asterisk ("*") can be used as a
wildcard to represent 0 or more occurrences of any character.<DD><CODE>includeHidden</CODE>
- boolean indicating whether files marked as hidden should be included or not
in the list of files and directories returned. <DT><B>Returns:</B><DD>An Enumeration of
strings, denoting the files and directories in the directory matching the
filter. Directories are denoted with a trailing slash "/" in their returned
name. The Enumeration has zero length if the directory is empty or no files
and/or directories are found matching the given filter. Any current directory
indication (".") and any parent directory indication ("..") is not included in
the list of files and directories returned. <DT><B>Throws:</B>
<DD>
<CODE>java.io.IOException</CODE> - if invoked on a file, the directory does not
exist, the directory is not accessible, or an I/O error occurs.
<DD>
<CODE><A HREF="../../../../javax/microedition/io/file/ConnectionClosedException.html">ConnectionClosedException</A></CODE>
- if the connection is closed.
<DD>
<CODE>java.lang.SecurityException</CODE> - if the security of the application
does not have read access for the directory.
<DD>
<CODE><A HREF="../../../../javax/microedition/io/file/IllegalModeException.html">IllegalModeException</A></CODE>
- if the application does have read access to the connection's target but has
opened the connection in <code>Connector.WRITE</code> mode.
<DD>
<CODE>java.lang.NullPointerException</CODE> - if <code>filter</code> is <code>null</code>.
<DD>
<CODE>java.lang.IllegalArgumentException</CODE> - if filter contains any path
specification or is an invalid filename for the platform (e.g. contains
characters invalid for a filename on the platform).</DD></DL>
</DD>
</DL>
<HR>
<A NAME="create()"><!-- --></A><H3>
create</H3>
<PRE>
public void <B>create</B>()
throws java.io.IOException</PRE>
<DL>
<DD>
Creates a file corresponding to the file string provided in the
Connector.open() method for this FileConnection. The file is created
immediately on the actual file system upon invocation of this method. Files are
created with zero length and data can be put into the file through output
streams opened on the file. This method does not create any directories
specified in the file's path.
<P></P>
<DD>
<DL>
</DL>
<DD>
<DL>
<DT><B>Throws:</B>
<DD>
<CODE>java.lang.SecurityException</CODE> - if the security of the application
does not have write access for the file.
<DD>
<CODE><A HREF="../../../../javax/microedition/io/file/IllegalModeException.html">IllegalModeException</A></CODE>
- if the application does have write access to the file but has opened the
connection in <code>Connector.READ</code> mode.
<DD>
<CODE>java.io.IOException</CODE> - if invoked on an existing file or on any
directory (<code>mkdir()</code> is used to create directories), the
connection's target has a trailing "/" to denote a directory, the target file
system is not accessible, or an unspecified error occurs preventing creation of
the file.
<DD>
<CODE><A HREF="../../../../javax/microedition/io/file/ConnectionClosedException.html">ConnectionClosedException</A></CODE>
- if the connection is closed.</DD></DL>
</DD>
</DL>
<HR>
<A NAME="mkdir()"><!-- --></A><H3>
mkdir</H3>
<PRE>
public void <B>mkdir</B>()
throws java.io.IOException</PRE>
<DL>
<DD>
Creates a directory corresponding to the directory string provided in the
Connector.open() method. The directory is created immediately on the actual
file system upon invocation of this method. Directories in the specified path
are not recursively created and must be explicitly created before
subdirectories can be created.
<P></P>
<DD>
<DL>
</DL>
<DD>
<DL>
<DT><B>Throws:</B>
<DD>
<CODE>java.lang.SecurityException</CODE> - if the security of the application
does not have write access to the directory.
<DD>
<CODE><A HREF="../../../../javax/microedition/io/file/IllegalModeException.html">IllegalModeException</A></CODE>
- if the application does have write access to the directory but has opened the
connection in <code>Connector.READ</code> mode.
<DD>
<CODE>java.io.IOException</CODE> - if invoked on an existing directory or on
any file (<code>create()</code> is used to create files), the target file sytem
is not accessible, or an unspecified error occurs preventing creation of the
directory.
<DD>
<CODE><A HREF="../../../../javax/microedition/io/file/ConnectionClosedException.html">ConnectionClosedException</A></CODE>
- if the connection is closed.</DD></DL>
</DD>
</DL>
<HR>
<A NAME="exi
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -