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

📄 javax.comm.commport.html

📁 java串口通讯api
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<!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.CommPort
</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="Package-javax.comm.html">Previous</a>  <a href="javax.comm.CommPortIdentifier.html#_top_">Next</a>  <a href="AllNames.html">Index</a></pre>
<hr>
<h1>
  Class javax.comm.CommPort
</h1>
<pre>
java.lang.Object
   |
   +----javax.comm.CommPort
</pre>
<hr>
<dl>
  <dt> public abstract class <b>CommPort</b>
  <dt> extends Object
</dl>
A communications port. <CODE>CommPort</CODE> is an abstract class that describes a communications port made available by the underlying system. It includes high-level methods for controlling I/O that are common to different kinds of communications ports. <CODE>SerialPort</CODE> and <CODE>ParallelPort</CODE> are subclasses of <CODE>CommPort</CODE> that include additional methods for low-level control of physical communications ports. <P> There are no public constructors for <CODE>CommPort</CODE>. Instead an application should use the static method <CODE>CommPortIdentifier.getPortIdentifiers</CODE> to generate a list of available ports. It then chooses a port from this list and calls <CODE>CommPortIdentifier.open</CODE> to create a <CODE>CommPort</CODE> object. Finally, it casts the <CODE>CommPort</CODE> object to a physical communications device class like <CODE>SerialPort</CODE> or <CODE>ParallelPort</CODE>. <P> After a communications port has been identified and opened it can be configured with the methods in the low-level classes like <CODE>SerialPort</CODE> and <CODE>ParallelPort</CODE>. Then an IO stream can be opend for reading and writing data. Once the application is done with the port, it must call the close method. Thereafter the application must not call any methods in the port object. Doing so will cause a <CODE>java.lang.IllegalStateException</CODE> to be thrown.
<p>
<dl>
    <dt> <b>See Also:</b>
    <dd> <a href="javax.comm.CommPortIdentifier.html#_top_">CommPortIdentifier</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/magenta-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#name"><b>name</b></a>
  <dd> 
</dl>
<h2>
  <img src="images/method-index.gif" width=207 height=38 alt="Method Index">
</h2>
<dl>
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#close()"><b>close</b></a>()
  <dd>  Closes the communications port.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#disableReceiveFraming()"><b>disableReceiveFraming</b></a>()
  <dd>  Disables receive framing.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#disableReceiveThreshold()"><b>disableReceiveThreshold</b></a>()
  <dd>  Disables receive threshold.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#disableReceiveTimeout()"><b>disableReceiveTimeout</b></a>()
  <dd>  Disables receive timeout.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#enableReceiveFraming(int)"><b>enableReceiveFraming</b></a>(int)
  <dd>  Enables receive framing, if this feature is supported by the driver.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#enableReceiveThreshold(int)"><b>enableReceiveThreshold</b></a>(int)
  <dd>  Enables receive threshold, if this feature is supported by the driver.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#enableReceiveTimeout(int)"><b>enableReceiveTimeout</b></a>(int)
  <dd>  Enables receive timeout, if this feature is supported by the driver.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#getInputBufferSize()"><b>getInputBufferSize</b></a>()
  <dd>  Gets the input buffer size.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#getInputStream()"><b>getInputStream</b></a>()
  <dd>  Returns an input stream.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#getName()"><b>getName</b></a>()
  <dd>  Gets the name of the communications port.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#getOutputBufferSize()"><b>getOutputBufferSize</b></a>()
  <dd>  Gets the output buffer size.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#getOutputStream()"><b>getOutputStream</b></a>()
  <dd>  Returns an output stream.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#getReceiveFramingByte()"><b>getReceiveFramingByte</b></a>()
  <dd>  Gets the current byte used for receive framing.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#getReceiveThreshold()"><b>getReceiveThreshold</b></a>()
  <dd>  Gets the integer value of the receive threshold.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#getReceiveTimeout()"><b>getReceiveTimeout</b></a>()
  <dd>  Gets the integer value of the receive timeout.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#isReceiveFramingEnabled()"><b>isReceiveFramingEnabled</b></a>()
  <dd>  Checks if receive framing is enabled.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#isReceiveThresholdEnabled()"><b>isReceiveThresholdEnabled</b></a>()
  <dd>  Checks if receive threshold is enabled.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#isReceiveTimeoutEnabled()"><b>isReceiveTimeoutEnabled</b></a>()
  <dd>  Checks if receive timeout is enabled.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#setInputBufferSize(int)"><b>setInputBufferSize</b></a>(int)
  <dd>  Sets the input buffer size.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#setOutputBufferSize(int)"><b>setOutputBufferSize</b></a>(int)
  <dd>  Sets the output buffer size.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#toString()"><b>toString</b></a>()
  <dd>  Returns a String representation of this communications port.
</dl>
<a name="variables"></a>
<h2>
  <img src="images/variables.gif" width=153 height=38 alt="Variables">
</h2>
<a name="name"><img src="images/magenta-ball.gif" width=12 height=12 alt=" o "></a>
<b>name</b>
<pre>
 protected String name
</pre>
<a name="methods"></a>
<h2>
  <img src="images/methods.gif" width=151 height=38 alt="Methods">
</h2>
<a name="getName()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="getName"><b>getName</b></a>
<pre>
 public String getName()
</pre>
<dl>
  <dd> Gets the name of the communications port. This name should correspond to something the user can identify, like the label on the hardware.
<p>
  <dd><dl>
    <dt> <b>Returns:</b>
    <dd> name of the port
  </dl></dd>
</dl>
<a name="toString()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="toString"><b>toString</b></a>
<pre>
 public String toString()
</pre>
<dl>
  <dd> Returns a String representation of this communications port.
<p>
  <dd><dl>
    <dt> <b>Returns:</b>
    <dd> String representation of the port
    <dt> <b>Overrides:</b>
    <dd> <a href="java.lang.Object.html#toString()">toString</a> in class Object
  </dl></dd>
</dl>
<a name="getInputStream()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="getInputStream"><b>getInputStream</b></a>
<pre>
 public abstract InputStream getInputStream() throws IOException
</pre>
<dl>
  <dd> Returns an input stream. This is the only way to receive data from the communications port. If the port is unidirectional and doesn't support receiving data, then <CODE>getInputStream</CODE> returns null. <P> The read behaviour of the input stream returned by <CODE>getInputStream</CODE> depends on combination of the threshold and timeout values. The possible behaviours are described in the table below: <P> <table border="1"> <tr> <th colspan=2>Threshold</th> <th colspan=2>Timeout</th> <th rowspan=2>Read Buffer Size</th> <th rowspan=2>Read Behaviour</th> </tr> <tr> <th>State</th> <th>Value</th> <th>State</th> <th>Value</th> </tr> <tr> <td> disabled </td> <td> - </td> <td> disabled </td> <td> - </td> <td> n bytes </td> <td> block until any data is available </td> </tr> <tr> <td> enabled </td> <td> m bytes </td> <td> disabled </td> <td> - </td> <td> n bytes </td> <td> block until min(<I>m</I>,<I>n</I>) bytes are available </td> </tr> <tr> <td> disabled </td> <td> - </td> <td> enabled </td> <td> x ms </td> <td> n bytes </td> <td> block for <I>x</I> ms or until any data is available </td> </tr> <tr> <td> enabled </td> <td> m bytes </td> <td> enabled </td> <td> x ms </td> <td> n bytes </td> <td> block for <I>x</I> ms or until min(<I>m</I>,<I>n</I>) bytes are available </td> </tr> </table>
<p>
  <dd><dl>
    <dt> <b>Returns:</b>
    <dd> InputStream object that can be used to read from the port
    <dt> <b>Throws:</b> IOException
    <dd> if an I/O error occurred
  </dl></dd>
</dl>
<a name="getOutputStream()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="getOutputStream"><b>getOutputStream</b></a>
<pre>

⌨️ 快捷键说明

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