📄 javax.comm.commportidentifier.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<!--NewPage-->
<html>
<head>
<!-- Generated by javadoc on Sun Nov 15 16:06:15 PST 1998 -->
<title>
Class javax.comm.CommPortIdentifier
</title>
</head>
<body>
<a name="_top_"></a>
<pre>
<a href="packages.html">All Packages</a> <a href="tree.html">Class Hierarchy</a> <a href="Package-javax.comm.html">This Package</a> <a href="javax.comm.CommPort.html#_top_">Previous</a> <a href="javax.comm.ParallelPort.html#_top_">Next</a> <a href="AllNames.html">Index</a></pre>
<hr>
<h1>
Class javax.comm.CommPortIdentifier
</h1>
<pre>
java.lang.Object
|
+----javax.comm.CommPortIdentifier
</pre>
<hr>
<dl>
<dt> public class <b>CommPortIdentifier</b>
<dt> extends Object
</dl>
Communications port management. <CODE>CommPortIdentifier</CODE> is the central class for controlling access to communications ports. It includes methods for: <UL> <LI> Determining the communications ports made available by the driver. <LI> Opening communications ports for I/O operations. <LI> Determining port ownership. <LI> Resolving port ownership contention. <LI> Managing events that indicate changes in port ownership status. </UL> <P> An application first uses methods in <CODE>CommPortIdentifier</CODE> to negotiate with the driver to discover which communication ports are available and then select a port for opening. It then uses methods in other classes like <CODE>CommPort</CODE>, <CODE>ParallelPort</CODE> and <CODE>SerialPort</CODE> to communicate through the port.
<p>
<dl>
<dt> <b>See Also:</b>
<dd> <a href="javax.comm.CommPort.html#_top_">CommPort</a>, <a href="javax.comm.CommPortOwnershipListener.html#_top_">CommPortOwnershipListener</a>, <a href="javax.comm.ParallelPort.html#_top_">ParallelPort</a>, <a href="javax.comm.SerialPort.html#_top_">SerialPort</a>
</dl>
<hr>
<a name="index"></a>
<h2>
<img src="images/variable-index.gif" width=207 height=38 alt="Variable Index">
</h2>
<dl>
<dt> <img src="images/blue-ball-small.gif" width=6 height=6 alt=" o ">
<a href="#PORT_PARALLEL"><b>PORT_PARALLEL</b></a>
<dd> IEEE 1284 parallel port
<dt> <img src="images/blue-ball-small.gif" width=6 height=6 alt=" o ">
<a href="#PORT_SERIAL"><b>PORT_SERIAL</b></a>
<dd> RS-232 serial port
</dl>
<h2>
<img src="images/method-index.gif" width=207 height=38 alt="Method Index">
</h2>
<dl>
<dt> <img src="images/green-ball-small.gif" width=6 height=6 alt=" o ">
<a href="#addPortName(java.lang.String, int, javax.comm.CommDriver)"><b>addPortName</b></a>(String, int, CommDriver)
<dd> Adds <CODE>portName</CODE> to the list of ports.
<dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
<a href="#addPortOwnershipListener(javax.comm.CommPortOwnershipListener)"><b>addPortOwnershipListener</b></a>(CommPortOwnershipListener)
<dd> Registers an interested application so that it can receive notification of changes in port ownership.
<dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
<a href="#getCurrentOwner()"><b>getCurrentOwner</b></a>()
<dd> Returns the owner of the port.
<dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
<a href="#getName()"><b>getName</b></a>()
<dd> Returns the name of the port.
<dt> <img src="images/green-ball-small.gif" width=6 height=6 alt=" o ">
<a href="#getPortIdentifier(javax.comm.CommPort)"><b>getPortIdentifier</b></a>(CommPort)
<dd> Obtains the <CODE>CommPortIdentifier</CODE> object corresponding to a port that has already been opened by the application.
<dt> <img src="images/green-ball-small.gif" width=6 height=6 alt=" o ">
<a href="#getPortIdentifier(java.lang.String)"><b>getPortIdentifier</b></a>(String)
<dd> Obtains a <CODE>CommPortIdentifier</CODE> object by using a port name.
<dt> <img src="images/green-ball-small.gif" width=6 height=6 alt=" o ">
<a href="#getPortIdentifiers()"><b>getPortIdentifiers</b></a>()
<dd> Obtains an enumeration object that contains a <CODE>CommPortIdentifier</CODE> object for each port in the system.
<dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
<a href="#getPortType()"><b>getPortType</b></a>()
<dd> Returns the port type.
<dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
<a href="#isCurrentlyOwned()"><b>isCurrentlyOwned</b></a>()
<dd> Checks whether the port is owned.
<dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
<a href="#open(java.io.FileDescriptor)"><b>open</b></a>(FileDescriptor)
<dd> Opens the communications port using a <CODE>FileDescriptor</CODE> object on platforms that support this technique.
<dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
<a href="#open(java.lang.String, int)"><b>open</b></a>(String, int)
<dd> Opens the communications port.
<dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
<a href="#removePortOwnershipListener(javax.comm.CommPortOwnershipListener)"><b>removePortOwnershipListener</b></a>(CommPortOwnershipListener)
<dd> Deregisters a <CODE>CommPortOwnershipListener</CODE> registered using <CODE>addPortOwnershipListener</CODE>
</dl>
<a name="variables"></a>
<h2>
<img src="images/variables.gif" width=153 height=38 alt="Variables">
</h2>
<a name="PORT_SERIAL"><img src="images/blue-ball.gif" width=12 height=12 alt=" o "></a>
<b>PORT_SERIAL</b>
<pre>
public static final int PORT_SERIAL
</pre>
<dl>
<dd> RS-232 serial port<p>
</dl>
<a name="PORT_PARALLEL"><img src="images/blue-ball.gif" width=12 height=12 alt=" o "></a>
<b>PORT_PARALLEL</b>
<pre>
public static final int PORT_PARALLEL
</pre>
<dl>
<dd> IEEE 1284 parallel port<p>
</dl>
<a name="methods"></a>
<h2>
<img src="images/methods.gif" width=151 height=38 alt="Methods">
</h2>
<a name="getPortIdentifiers()"><img src="images/green-ball.gif" width=12 height=12 alt=" o "></a>
<a name="getPortIdentifiers"><b>getPortIdentifiers</b></a>
<pre>
public static Enumeration getPortIdentifiers()
</pre>
<dl>
<dd> Obtains an enumeration object that contains a <CODE>CommPortIdentifier</CODE> object for each port in the system.
<p>
<dd><dl>
<dt> <b>Returns:</b>
<dd> an <CODE> Enumeration </CODE> object that can be used to enumerate all the ports known to the system
<dt> <b>See Also:</b>
<dd> Enumeration
</dl></dd>
</dl>
<a name="getPortIdentifier(java.lang.String)"><img src="images/green-ball.gif" width=12 height=12 alt=" o "></a>
<a name="getPortIdentifier"><b>getPortIdentifier</b></a>
<pre>
public static <a href="#_top_">CommPortIdentifier</a> getPortIdentifier(String portName) throws <a href="javax.comm.NoSuchPortException.html#_top_">NoSuchPortException</a>
</pre>
<dl>
<dd> Obtains a <CODE>CommPortIdentifier</CODE> object by using a port name. The port name may have been stored in persistent storage by the application.
<p>
<dd><dl>
<dt> <b>Parameters:</b>
<dd> <CODE>portName</CODE> - name of the port to open
<dt> <b>Returns:</b>
<dd> a <CODE>CommPortIdentifier</CODE> object
<dt> <b>Throws:</b> <a href="javax.comm.NoSuchPortException.html#_top_">NoSuchPortException</a>
<dd> if the port does not exist
</dl></dd>
</dl>
<a name="getPortIdentifier(javax.comm.CommPort)"><img src="images/green-ball.gif" width=12 height=12 alt=" o "></a>
<a name="getPortIdentifier"><b>getPortIdentifier</b></a>
<pre>
public static <a href="#_top_">CommPortIdentifier</a> getPortIdentifier(<a href="javax.comm.CommPort.html#_top_">CommPort</a> port) throws <a href="javax.comm.NoSuchPortException.html#_top_">NoSuchPortException</a>
</pre>
<dl>
<dd> Obtains the <CODE>CommPortIdentifier</CODE> object corresponding to a port that has already been opened by the application.
<p>
<dd><dl>
<dt> <b>Parameters:</b>
<dd> port - a CommPort object obtained from a previous open
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -