📄 javalang.doc16.html
字号:
<p><font size=+1><strong>20.17.20 </strong> <code>public void <code><b>checkWrite</b></code>(int fd)<br>throws SecurityException</code></font>
<p>
<a name="20000"></a>
The general contract of this method is that it should throw a <code>SecurityException</code>
if creating an output stream using the specified file descriptor is not permitted.
<p><a name="21916"></a>
This method is invoked for the current security manager <a href="javalang.doc17.html#3205">(§20.18.4)</a> by one constructor for <code>java.io.FileOutputStream</code> <a href="javaio.doc14.html#29525">(§22.16.3)</a>.<p>
<a name="21920"></a>
The <code>checkWrite</code> method defined by class <code>SecurityManager</code> always throws a <code>SecurityException</code>. A subclass must override this method if creating an output stream from an existing file descriptor is to be permitted with a security manager installed.<p>
<a name="14117"></a>
<p><font size=+1><strong>20.17.21 </strong> <code>public void <code><b>checkWrite</b></code>(String file)<br>throws SecurityException</code></font>
<p>
<a name="20009"></a>
The general contract of this method is that it should throw a <code>SecurityException</code>
if writing, modifying, creating (for output), or renaming the specified file or directory
is not permitted.
<p><a name="20013"></a>
This method is invoked for the current security manager <a href="javalang.doc17.html#3205">(§20.18.4)</a> by two constructors for <code>java.io.FileOutputStream</code> (<a href="javaio.doc14.html#29510">§22.16.1</a>, <a href="javaio.doc14.html#29518">§22.16.2</a>); by two constructors for <code>java.io.RandomAccessFile</code> (<a href="javaio.doc21.html#27788">§22.23.1</a>, <a href="javaio.doc21.html#27799">§22.23.2</a>); and by methods <code>canWrite</code> <a href="javaio.doc22.html#29809">(§22.24.18)</a>, <code>mkdir</code> <a href="javaio.doc22.html#29847">(§22.24.23)</a>, and <code>renameTo</code> <a href="javaio.doc22.html#29875">(§22.24.27)</a> of class <code>java.io.File</code>.<p>
<a name="21924"></a>
The <code>checkWrite</code> method defined by class <code>SecurityManager</code> always throws a <code>SecurityException</code>. A subclass must override this method if write access to a file is to be permitted with a security manager installed.<p>
<a name="14118"></a>
<p><font size=+1><strong>20.17.22 </strong> <code>public void <code><b>checkDelete</b></code>(String file)<br>throws SecurityException</code></font>
<p>
<a name="20018"></a>
The general contract of this method is that it should throw a <code>SecurityException</code>
if deleting the specified file is not permitted.
<p><a name="20022"></a>
This method is invoked for the current security manager <a href="javalang.doc17.html#3205">(§20.18.4)</a> by method <code>delete</code> <a href="javaio.doc22.html#29882">(§22.24.28)</a> of class <code>java.io.File</code>.<p>
<a name="20023"></a>
The <code>checkDelete</code> method defined by class <code>SecurityManager</code> always throws a <code>SecurityException</code>. A subclass must override this method if a file deletion operation is to be permitted with a security manager installed.<p>
<a name="14119"></a>
<p><font size=+1><strong>20.17.23 </strong> <code>public void <code><b>checkConnect</b></code>(String host, int port)<br> throws SecurityException</code></font>
<p>
<a name="20030"></a>
The general contract of this method is that it should throw a <code>SecurityException</code>
if connecting to the indicated <code>port</code> of the indicated network <code>host</code> is not permitted.
<p><a name="29737"></a>
This method is invoked for the current security manager <a href="javalang.doc17.html#3205">(§20.18.4)</a> by two constructors for class <code>java.net.Socket</code>, methods <code>send</code> and <code>receive</code> of class <code>java.net.DatagramSocket</code>, and methods <code>getByName</code> and <code>getAllByName</code> of class <code>java.net.InetAddress</code>. (These classes are not documented in this specification. See <i>The Java Application Programming Interface</i>.)<p>
<a name="20035"></a>
The <code>checkConnect</code> method defined by class <code>SecurityManager</code> always throws a <code>SecurityException</code>. A subclass must override this method if a network connection is to be permitted with a security manager installed.<p>
<a name="14120"></a>
<p><font size=+1><strong>20.17.24 </strong> <code>public void <code><b>checkListen</b></code>(int port)<br>throws SecurityException</code></font>
<p>
<a name="20039"></a>
The general contract of this method is that it should throw a <code>SecurityException</code>
if listening to the specified local network <code>port</code> is not permitted.
<p><a name="29786"></a>
This method is invoked for the current security manager <a href="javalang.doc17.html#3205">(§20.18.4)</a> by the constructor of one argument for class <code>java.net.DatagramSocket</code> and by the constructors for class <code>java.net.ServerSocket</code>. (These classes are not documented in this specification. See <i>The Java Application Programming Interface</i>.)<p>
<a name="20044"></a>
The <code>checkListen</code> method defined by class <code>SecurityManager</code> always throws a <code>SecurityException</code>. A subclass must override this method if listening to a local network port is to be permitted with a security manager installed.<p>
<a name="14121"></a>
<p><font size=+1><strong>20.17.25 </strong> <code>public void <code><b>checkAccept</b></code>(String host, int port)<br>throws SecurityException</code></font>
<p>
<a name="29810"></a>
The general contract of this method is that it should throw a <code>SecurityException</code>
if accepting a connection from the indicated <code>port</code> of the indicated network <code>host</code>
is not permitted.
<p><a name="20052"></a>
This method is invoked for the current security manager <a href="javalang.doc17.html#3205">(§20.18.4)</a> by method <code>accept</code> of class <code>java.net.ServerSocket</code>. (This class is not documented in this specification. See <i>The Java Application Programming Interface</i>.)<p>
<a name="20053"></a>
The <code>checkAccept</code> method defined by class <code>SecurityManager</code> always throws a <code>SecurityException</code>. A subclass must override this method if accepting a network connection is to be permitted with a security manager installed.<p>
<a name="14128"></a>
<p><font size=+1><strong>20.17.26 </strong> <code>public void <code><b>checkSetFactory</b></code>()<br>throws SecurityException</code></font>
<p>
<a name="20088"></a>
The general contract of this method is that it should throw a <code>SecurityException</code>
if installing a "factory" for a socket, server socket, URL, or URL connection is not
permitted.
<p><a name="20092"></a>
This method is invoked for the current security manager <a href="javalang.doc17.html#3205">(§20.18.4)</a> by:<p>
<pre><a name="29846"></a> method setSocketFactory of class java.net.ServerSocket
<a name="29848"></a> method setSocketImplFactory of class java.net.Socket
<a name="29849"></a> method setURLStreamHandlerFactory of class java.net.URL
<a name="29852"></a> method setContentHandlerFactory of class java.net.URLConnection
</pre><a name="20093"></a>
(These classes are not documented in this specification. See <i>The Java Application
Programming Interface</i>.)
<p><a name="29916"></a>
The <code>checkSetFactory</code> method defined by class <code>SecurityManager</code> always throws a <code>SecurityException</code>. A subclass must override this method if a factory installation operation is to be permitted with a security manager installed.<p>
<a name="29924"></a>
<p><font size=+1><strong>20.17.27 </strong> <code>public boolean <code><b>checkTopLevelWindow</b></code>()<br>throws SecurityException</code></font>
<p>
<a name="29925"></a>
The general contract of this method is that it should throw a <code>SecurityException</code>
if creation of a top-level window is not permitted. If creation of a top-level window
is permitted, then this method should return <code>false</code> if the window ought to
bear a clear warning that it is a window for an executable applet. A returned value
of <code>true</code> means that the security manager places no restriction on window creation.
<p><a name="29929"></a>
This method is invoked for the current security manager <a href="javalang.doc17.html#3205">(§20.18.4)</a> by the constructors for class <code>java.awt.Window</code>. (This class is not documented in this specification. See <i>The Java Application Programming Interface</i>.)<p>
<a name="29930"></a>
The <code>checkTopLevelWindow</code> method defined by class <code>SecurityManager</code> always returns <code>false</code>. A subclass must override this method if a window creation operation is to be unrestricted or forbidden with a security manager installed.<p>
<a name="36460"></a>
<p><font size=+1><strong>20.17.28 </strong> <code>public void <code><b>checkPackageAccess</b></code>(String packageName)<br>throws SecurityException</code></font>
<p>
<a name="36453"></a>
The general contract of this method is that it should throw a <code>SecurityException</code>
if the current applet is not permitted to access the package named by the argument.
This method is intended for use by Java-capable web browsers.
<p><a name="36483"></a>
The <code>checkPackageAccess</code> method defined by class <code>SecurityManager</code> always throws a <code>SecurityException</code>. A subclass must override this method if package access by an applet is to be permitted with a security manager installed.<p>
<a name="36488"></a>
<p><font size=+1><strong>20.17.29 </strong> <code>public void <code><b>checkPackageDefinition</b></code>(String packageName)<br>throws SecurityException</code></font>
<p>
<a name="36489"></a>
The general contract of this method is that it should throw a <code>SecurityException</code>
if the current applet is not permitted to define a class (or interface) in the package
named by the argument. This method is intended for use by Java-capable web
browsers.
<p><a name="36490"></a>
The <code>checkPackageAccess</code> method defined by class <code>SecurityManager</code> always throws a <code>SecurityException</code>. A subclass must override this method if class definition by an applet is to be permitted with a security manager installed.<p>
<hr>
<!-- This inserts footnotes--><p>
<a href="index.html">Contents</a> | <a href="javalang.doc15.html">Prev</a> | <a href="javalang.doc17.html">Next</a> | <a href="j.index.doc1.html">Index</a>
<p>
<font size=-1>Java Language Specification (HTML generated by Suzette Pelouch on February 24, 1998)<br>
<i><a href="jcopyright.doc.html">Copyright © 1996 Sun Microsystems, Inc.</a>
All rights reserved</i>
<br>
Please send any comments or corrections to <a href="mailto:doug.kramer@sun.com">doug.kramer@sun.com</a>
</font>
</body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -