📄 fileconnection.html
字号:
<DD>
<CODE>java.lang.SecurityException</CODE> - if the security of the application
does not have read access to the root volume.
<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>
<CODE><A HREF="../../../../javax/microedition/io/file/ConnectionClosedException.html">ConnectionClosedException</A></CODE>
- if the connection is closed.</DD></DL>
</DD>
</DL>
<HR>
<A NAME="usedSize()"><!-- --></A><H3>
usedSize</H3>
<PRE>
public long <B>usedSize</B>()</PRE>
<DL>
<DD>
Determines the used memory of a file system the connection's target resides on.
This may only be an estimate and may vary based on platform-specific file
system blocking and metadata information.
<P></P>
<DD>
<DL>
</DL>
<DD>
<DL>
<DT><B>Returns:</B><DD>The used size of bytes on a file system, or -1 if the file
system is not accessible. <DT><B>Throws:</B>
<DD>
<CODE>java.lang.SecurityException</CODE> - if the security of the application
does not have read access to the root volume.
<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>
<CODE><A HREF="../../../../javax/microedition/io/file/ConnectionClosedException.html">ConnectionClosedException</A></CODE>
- if the connection is closed.</DD></DL>
</DD>
</DL>
<HR>
<A NAME="directorySize(boolean)"><!-- --></A><H3>
directorySize</H3>
<PRE>
public long <B>directorySize</B>(boolean includeSubDirs)
throws java.io.IOException</PRE>
<DL>
<DD>
Determines the size in bytes on a file system of all of the files that are
contained in a directory.
<P></P>
<DD>
<DL>
</DL>
<DD>
<DL>
<DT><B>Returns:</B><DD>The size in bytes occupied by the files included in the
directory, or -1 if the directory does not exist or is not accessible. <DT><B>Throws:</B>
<DD>
<CODE>java.io.IOException</CODE> - if the method is invoked on a file.
<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>
<CODE><A HREF="../../../../javax/microedition/io/file/ConnectionClosedException.html">ConnectionClosedException</A></CODE>
- if the connection is closed.</DD></DL>
</DD>
</DL>
<HR>
<A NAME="fileSize()"><!-- --></A><H3>
fileSize</H3>
<PRE>
public long <B>fileSize</B>()
throws java.io.IOException</PRE>
<DL>
<DD>
Determines the size of a file on the file system. The size of a file always
represents the number of bytes contained in the file; there is no pre-allocated
but empty space in a file. Users should perform an explicit <code>flush()</code>
on any open output streams to the file prior to invoking this method to ensure
accurate results.
<P></P>
<DD>
<DL>
</DL>
<DD>
<DL>
<DT><B>Returns:</B><DD>The size in bytes of the selected file, or -1 if the file does
not exist or is not accessible. <DT><B>Throws:</B>
<DD>
<CODE>java.io.IOException</CODE> - if the method is invoked on a directory.
<DD>
<CODE>java.lang.SecurityException</CODE> - if the security of the application
does not have read access for the file.
<DD>
<CODE><A HREF="../../../../javax/microedition/io/file/IllegalModeException.html">IllegalModeException</A></CODE>
- if the application does have read access to the file but has opened the
connection in <code>Connector.WRITE</code> mode.
<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="canRead()"><!-- --></A><H3>
canRead</H3>
<PRE>
public boolean <B>canRead</B>()</PRE>
<DL>
<DD>
Checks if the file or directory is readable. This method checks the attributes
associated with a file or directory by the underlying file system. Some file
systems may not support associating a read attribute with a file, in which case
this method returns true.
<P></P>
<DD>
<DL>
</DL>
<DD>
<DL>
<DT><B>Returns:</B><DD>true if the connection's target exists, is accessible, and is
readable, otherwise false. <DT><B>Throws:</B>
<DD>
<CODE>java.lang.SecurityException</CODE> - if the security of the application
does not have read access for the connection's target.
<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><A HREF="../../../../javax/microedition/io/file/ConnectionClosedException.html">ConnectionClosedException</A></CODE>
- if the connection is closed.<DT><B>See Also:</B><DD><A HREF="../../../../javax/microedition/io/file/FileConnection.html#setReadable(boolean)"><CODE>setReadable(boolean)</CODE></A></DD></DL>
</DD>
</DL>
<HR>
<A NAME="canWrite()"><!-- --></A><H3>
canWrite</H3>
<PRE>
public boolean <B>canWrite</B>()</PRE>
<DL>
<DD>
Checks if the file or directory is writable. This method checks the attributes
associated with a file or directory by the underlying file system. Some file
systems may not support associating a write attribute with a file, in which
case this method returns true.
<P></P>
<DD>
<DL>
</DL>
<DD>
<DL>
<DT><B>Returns:</B><DD>true if the connection's target exists, is accessible, and is
writable, otherwise false. <DT><B>Throws:</B>
<DD>
<CODE>java.lang.SecurityException</CODE> - if the security of the application
does not have read access for the connection's target.
<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><A HREF="../../../../javax/microedition/io/file/ConnectionClosedException.html">ConnectionClosedException</A></CODE>
- if the connection is closed.<DT><B>See Also:</B><DD><A HREF="../../../../javax/microedition/io/file/FileConnection.html#setWritable(boolean)"><CODE>setWritable(boolean)</CODE></A></DD></DL>
</DD>
</DL>
<HR>
<A NAME="isHidden()"><!-- --></A><H3>
isHidden</H3>
<PRE>
public boolean <B>isHidden</B>()</PRE>
<DL>
<DD>
Checks if the file is hidden. The exact definition of hidden is
system-dependent. For example, on UNIX systems a file is considered to be
hidden if its name begins with a period character ('.'). On Win32 and FAT file
systems, a file is considered to be hidden if it has been marked as such in the
file's attributes. If hidden files are not supported on the referenced file
system, this method always returns false.
<P></P>
<DD>
<DL>
</DL>
<DD>
<DL>
<DT><B>Returns:</B><DD>true if the file exists, is accessible, and is hidden, otherwise
false. <DT><B>Throws:</B>
<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 connection's target.
<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.<DT><B>See Also:</B><DD><A HREF="../../../../javax/microedition/io/file/FileConnection.html#setHidden(boolean)"><CODE>setHidden(boolean)</CODE></A></DD></DL>
</DD>
</DL>
<HR>
<A NAME="setReadable(boolean)"><!-- --></A><H3>
setReadable</H3>
<PRE>
public void <B>setReadable</B>(boolean readable)
throws java.io.IOException</PRE>
<DL>
<DD>
Sets the file or directory readable attribute to the indicated value. The
readable attribute for the file on the actual file system is set immediately
upon invocation of this method. If the file system doesn't support a settable
read attribute, this method is ignored and <code>canRead()</code> always
returns true.
<P></P>
<DD>
<DL>
</DL>
<DD>
<DL>
<DT><B>Parameters:</B><DD><CODE>readable</CODE> - The new state of the readable flag of
the selected file. <DT><B>Throws:</B>
<DD>
<CODE>java.io.IOException</CODE> - of 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#canRead()"><CODE>canRead()</CODE></A></DD></DL>
</DD>
</DL>
<HR>
<A NAME="setWritable(boolean)"><!-- --></A><H3>
setWritable</H3>
<PRE>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -