Package gnu.io.factory
Class DefaultSerialPortFactory
- java.lang.Object
-
- gnu.io.factory.DefaultSerialPortFactory
-
- All Implemented Interfaces:
SerialPortFactory
public class DefaultSerialPortFactory extends java.lang.Object implements SerialPortFactory
-
-
Constructor Summary
Constructors Constructor Description DefaultSerialPortFactory()
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SerialPort
createSerialPort(java.lang.String portName)
Creates aSerialPort
instance out of the givenportName
.<T extends SerialPort>
TcreateSerialPort(java.lang.String portName, java.lang.Class<T> expectedClass)
Creates aSerialPort
instance out of the givenportName
.SerialPortRegistry
getPortRegistry()
Gets theSerialPortRegistry
to register/unregisterSerialPortCreator
s.
-
-
-
Method Detail
-
createSerialPort
public <T extends SerialPort> T createSerialPort(java.lang.String portName, java.lang.Class<T> expectedClass) throws PortInUseException, NoSuchPortException, UnsupportedCommOperationException
Description copied from interface:SerialPortFactory
Creates aSerialPort
instance out of the givenportName
.- Specified by:
createSerialPort
in interfaceSerialPortFactory
- Parameters:
portName
- The port's name to parse out whether to create a serial connection or a remote (rfc2217) connection.expectedClass
- TheSerialPort
class that is expected to return.- Returns:
- The newly created and opened SerialPort.
- Throws:
PortInUseException
NoSuchPortException
UnsupportedCommOperationException
-
createSerialPort
public SerialPort createSerialPort(java.lang.String portName) throws PortInUseException, NoSuchPortException, UnsupportedCommOperationException
Description copied from interface:SerialPortFactory
Creates aSerialPort
instance out of the givenportName
.- Specified by:
createSerialPort
in interfaceSerialPortFactory
- Parameters:
portName
- The port's name to parse out whether to create a serial connection or a remote (rfc2217) connection.- Returns:
- The newly created and opened SerialPort.
- Throws:
PortInUseException
NoSuchPortException
UnsupportedCommOperationException
-
getPortRegistry
public SerialPortRegistry getPortRegistry()
Gets theSerialPortRegistry
to register/unregisterSerialPortCreator
s.- Returns:
-
-