Package gnu.io.rfc2217
Class ComPortCommand
- java.lang.Object
-
- gnu.io.rfc2217.ComPortCommand
-
- Direct Known Subclasses:
BaudRateCommand,ControlCommand,DataSizeCommand,FlowControlResumeCommand,FlowControlSuspendCommand,LineStateMaskCommand,ModemStateMaskCommand,NotifyLineStateCommand,NotifyModemStateCommand,ParityCommand,PurgeDataCommand,SignatureCommand,StopSizeCommand
public abstract class ComPortCommand extends java.lang.ObjectSuperclass for RFC 2217 commands. Instances of this class (and all subclasses) are immutable.- See Also:
- RFC 2217
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedComPortCommand(java.lang.String name, int command, int[] bytes)Constructor.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object obj)int[]getBytes()Get the encoding of this instance.intgetCommand()Get the command byte.java.lang.StringgetName()Get the human-readable name of this option.inthashCode()booleanisServerCommand()Determine if this command is client-to-server or server-to-client.abstract java.lang.StringtoString()Get the human-readable description of this option.abstract voidvisit(ComPortCommandSwitch sw)Apply visitor pattern.
-
-
-
Constructor Detail
-
ComPortCommand
protected ComPortCommand(java.lang.String name, int command, int[] bytes)Constructor.- Parameters:
name- human readable name of this commandcommand- requiredCOM-PORT-OPTIONcommand byte value (must be the client-to-server value)bytes- encoded command starting with theCOM-PORT-OPTIONbyte NullPointerException ifbytesis null IllegalArgumentException ifbyteshas length that is too short or too long IllegalArgumentException ifbytes[0]is notRFC2217.COM_PORT_OPTIONIllegalArgumentException ifcommandis greater than or equal toRFC2217.SERVER_OFFSETIllegalArgumentException ifbytes[1]is notcommandorcommand+RFC2217.SERVER_OFFSET
-
-
Method Detail
-
isServerCommand
public final boolean isServerCommand()
Determine if this command is client-to-server or server-to-client.- Returns:
- true if this command is sent from the server to the client, false for the opposite
-
getBytes
public final int[] getBytes()
Get the encoding of this instance.- Returns:
- encoding starting with
COM-PORT-OPTION
-
getCommand
public final int getCommand()
Get the command byte.- Returns:
- RFC 2217-defined byte value for this command
-
getName
public java.lang.String getName()
Get the human-readable name of this option.
-
toString
public abstract java.lang.String toString()
Get the human-readable description of this option.- Overrides:
toStringin classjava.lang.Object
-
visit
public abstract void visit(ComPortCommandSwitch sw)
Apply visitor pattern.- Parameters:
sw- visitor switch handler
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
-