com.ibm.manplato.Transport
Class CommAPITransport
java.lang.Object
|
+--com.ibm.manplato.Transport.SLPTransportInterface
|
+--com.ibm.manplato.Transport.CommAPITransport
- public class CommAPITransport
- extends SLPTransportInterface
Sun Communications API Transport. This class provides a bridge between Sun Microsystem's Java
Communications API and the SLP Protocol class.
- Version:
- $Rev$-$Date: 2001/07/02 11:28:16 $$State: Exp $
- Author:
- File Created By: Brad BARCLAY <bbarclay@ca.ibm.com>, Last Modified By: $Author: fpal $
Field Summary |
protected boolean |
connected
|
protected java.io.DataInputStream |
dis
|
protected java.io.DataOutputStream |
dos
|
protected javax.comm.CommPortIdentifier |
port
|
protected javax.comm.SerialPort |
ser
|
Constructor Summary |
CommAPITransport(java.lang.String portName)
Create a new instance of the Comm API Transport. |
Method Summary |
void |
close()
Closes the Java COMM API port. |
protected void |
finalize()
|
void |
flush()
Flushes the input buffer of any remaining data. |
static java.lang.String |
getName()
Returns the name of this Transport Interface. |
static java.lang.String[] |
getPortNames()
Returns an array of Strings representing the names of available ports. |
void |
open()
Opens a read/write connection to the implemented transport. |
byte |
readByte()
Read a single byte from the Java COMM API port. |
void |
setSpeed(int speed)
Sets the speed of the underlying Java COMM API port. |
void |
writeBytes(byte[] data)
Writes an array of bytes to the Java COMM API port. |
Methods inherited from class java.lang.Object |
, clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
port
protected javax.comm.CommPortIdentifier port
ser
protected javax.comm.SerialPort ser
dis
protected java.io.DataInputStream dis
dos
protected java.io.DataOutputStream dos
connected
protected boolean connected
CommAPITransport
public CommAPITransport(java.lang.String portName)
throws java.lang.Exception
- Create a new instance of the Comm API Transport. This constructor creates a new instance of the
Comm API Transport.
- Parameters:
portName
- A string representing the Comm Port to be used.- Throws:
java.lang.Exception
- used to pass any exceptions thrown during initialization.
close
public void close()
throws java.lang.Exception
- Closes the Java COMM API port.
- Overrides:
close
in class SLPTransportInterface
- Throws:
java.lang.Exception
- any exception encountered is rethrown.
finalize
protected void finalize()
throws java.lang.Throwable
- Overrides:
finalize
in class java.lang.Object
flush
public void flush()
throws java.io.IOException
- Flushes the input buffer of any remaining data.
- Overrides:
flush
in class SLPTransportInterface
- Throws:
java.io.IOException
- thrown when a problem occurs with flushing the stream.
getName
public static java.lang.String getName()
- Returns the name of this Transport Interface. This method will return a string containing the name of
this transport interface. This is used when searching for and selecting from one of many available
transport interfaces that are installed on the system.
- Returns:
- the name of this transport interface.
getPortNames
public static java.lang.String[] getPortNames()
- Returns an array of Strings representing the names of available ports. This method will return to the
caller an array of strings representing the serial ports available on this system.
- Returns:
- an array of String representing the names of the available ports.
open
public void open()
throws java.lang.Exception
- Opens a read/write connection to the implemented transport. This method should open the transport
device being implemented using default parameters.
- Overrides:
open
in class SLPTransportInterface
- Throws:
java.io.IOException
- thrown when a problem occurs with flushing the stream.
readByte
public byte readByte()
- Read a single byte from the Java COMM API port.
- Overrides:
readByte
in class SLPTransportInterface
setSpeed
public void setSpeed(int speed)
throws java.lang.Exception
- Sets the speed of the underlying Java COMM API port.
- Overrides:
setSpeed
in class SLPTransportInterface
- Parameters:
speed
- The speed to set the transport to.- Throws:
java.io.IOException
- thrown when a problem occurs with flushing the stream.
writeBytes
public void writeBytes(byte[] data)
- Writes an array of bytes to the Java COMM API port.
- Overrides:
writeBytes
in class SLPTransportInterface
- Parameters:
data
- the bytes to be written to the serial port.