org.prelle.telnet.TelnetCommand Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of telnet Show documentation
Show all versions of telnet Show documentation
Telnet protocol implementation in Java
The newest version!
package org.prelle.telnet;
import org.prelle.telnet.TelnetConstants.ControlCode;
/**
*
*/
public class TelnetCommand {
private ControlCode code;
private Integer data;
//-------------------------------------------------------------------
public TelnetCommand(ControlCode code) {
this.code = code;
}
//-------------------------------------------------------------------
public TelnetCommand(ControlCode code, int value) {
this.code = code;
this.data = value;
}
//-------------------------------------------------------------------
public String toString() {
switch (code) {
case WILL: case WONT:
case DO : case DONT:
return code.name()+"("+data+")";
default:
return code.name();
}
}
//-------------------------------------------------------------------
public ControlCode getCode() { return code; }
public Integer getData() { return data; }
}