Package purejavacomm
Class CommPort
- java.lang.Object
-
- purejavacomm.CommPort
-
- Direct Known Subclasses:
SerialPort
public abstract class CommPort extends Object
-
-
Constructor Summary
Constructors Constructor Description CommPort()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidclose()Closes the communications port.abstract voiddisableReceiveFraming()Disables receive framing.abstract voiddisableReceiveThreshold()Disables receive threshold.abstract voiddisableReceiveTimeout()Disables receive timeout.abstract voidenableReceiveFraming(int framingByte)Enables receive framing.abstract voidenableReceiveThreshold(int threshold)Enables receive threshold.abstract voidenableReceiveTimeout(int rcvTimeout)Enables receive timeout.abstract intgetInputBufferSize()Returns the input buffer size in bytes.abstract InputStreamgetInputStream()Returns an input stream.StringgetName()Returns the port name.abstract intgetOutputBufferSize()Returns the output buffer size in bytes.abstract OutputStreamgetOutputStream()Returns an output stream.abstract intgetReceiveFramingByte()Returns the current byte used for receive framing.abstract intgetReceiveThreshold()Returns the integer value of the receive threshold.abstract intgetReceiveTimeout()Returns the integer value of the receive timeout.abstract booleanisReceiveFramingEnabled()Returnstrueif receive framing is enabled.abstract booleanisReceiveThresholdEnabled()Returnstrueif receive threshold is enabled.abstract booleanisReceiveTimeoutEnabled()Returnstrueif receive timeout is enabled.abstract voidsetInputBufferSize(int size)Sets the input buffer size.abstract voidsetOutputBufferSize(int size)Sets the output buffer size.
-
-
-
Field Detail
-
name
protected String name
-
-
Method Detail
-
close
public void close()
Closes the communications port.
-
disableReceiveFraming
public abstract void disableReceiveFraming()
Disables receive framing.
-
disableReceiveThreshold
public abstract void disableReceiveThreshold()
Disables receive threshold.
-
disableReceiveTimeout
public abstract void disableReceiveTimeout()
Disables receive timeout.
-
enableReceiveFraming
public abstract void enableReceiveFraming(int framingByte) throws UnsupportedCommOperationExceptionEnables receive framing.- Parameters:
framingByte-- Throws:
UnsupportedCommOperationException
-
enableReceiveThreshold
public abstract void enableReceiveThreshold(int threshold) throws UnsupportedCommOperationExceptionEnables receive threshold.- Parameters:
threshold-- Throws:
UnsupportedCommOperationException
-
enableReceiveTimeout
public abstract void enableReceiveTimeout(int rcvTimeout) throws UnsupportedCommOperationExceptionEnables receive timeout.- Parameters:
rcvTimeout- Timeout value in milliseconds- Throws:
UnsupportedCommOperationException
-
getInputBufferSize
public abstract int getInputBufferSize()
Returns the input buffer size in bytes.- Returns:
- The input buffer size in bytes.
-
getInputStream
public abstract InputStream getInputStream() throws IOException
Returns an input stream.- Returns:
- An input stream, or
nullif the port is unidirectional and doesn't support receiving data. - Throws:
IOException
-
getName
public String getName()
Returns the port name.- Returns:
- The port name.
-
getOutputBufferSize
public abstract int getOutputBufferSize()
Returns the output buffer size in bytes.- Returns:
- The output buffer size in bytes.
-
getOutputStream
public abstract OutputStream getOutputStream() throws IOException
Returns an output stream.- Returns:
- An output stream, or
nullif the port is unidirectional and doesn't support sending data. - Throws:
IOException
-
getReceiveFramingByte
public abstract int getReceiveFramingByte()
Returns the current byte used for receive framing.- Returns:
- The current byte used for receive framing.
-
getReceiveThreshold
public abstract int getReceiveThreshold()
Returns the integer value of the receive threshold.- Returns:
- The integer value of the receive threshold.
-
getReceiveTimeout
public abstract int getReceiveTimeout()
Returns the integer value of the receive timeout. If the receive timeout is disabled, then the value returned is meaningless.- Returns:
- The integer value of the receive timeout.
-
isReceiveFramingEnabled
public abstract boolean isReceiveFramingEnabled()
Returnstrueif receive framing is enabled.- Returns:
trueif receive framing is enabled.
-
isReceiveThresholdEnabled
public abstract boolean isReceiveThresholdEnabled()
Returnstrueif receive threshold is enabled.- Returns:
trueif receive threshold is enabled.
-
isReceiveTimeoutEnabled
public abstract boolean isReceiveTimeoutEnabled()
Returnstrueif receive timeout is enabled.- Returns:
trueif receive timeout is enabled.
-
setInputBufferSize
public abstract void setInputBufferSize(int size)
Sets the input buffer size.- Parameters:
size-
-
setOutputBufferSize
public abstract void setOutputBufferSize(int size)
Sets the output buffer size.- Parameters:
size-
-
-