📄 login.java
字号:
/**
*
* <p>Title: Sm内部协议解析</p>
* <p>Description: 登录包解析</p>
* <p>Copyright: Copyright (c) 2007</p>
* <p>Company: 福富软件</p>
* @author chenxin
* @version 1.0 $Date 2007-07-03
*/
package ffcs.lbp.le.message;
import java.nio.ByteBuffer;
import ffcs.lbp.MessageParseException;
import ffcs.lbp.LbpMessage;
public class Login extends LeMessage {
private String userId=null;
private String password=null;
public Login(){
super(Login);
}
protected boolean readBody(ByteBuffer buf) throws MessageParseException{
userId = LbpMessage.readOString(buf, 20);
password = LbpMessage.readOString(buf, 20);
return true;
}
protected boolean writeBody(ByteBuffer buf){
LbpMessage.writeCString(buf,userId);
LbpMessage.writeCString(buf,password);
return true;
}
protected int getBodyLength(){
int len = ((this.userId != null) ? userId.length() : 0)
+ ((password != null) ? password.length() : 0);
return len + 2;
}
/**
* @return 返回 password。
*/
public String getPassword() {
return password;
}
/**
* @param password 要设置的 password。
*/
public void setPassword(String password) {
this.password = password;
}
/**
* @return 返回 userId。
*/
public String getUserId() {
return userId;
}
/**
* @param userId 要设置的 userId。
*/
public void setUserId(String userId) {
this.userId = userId;
}
public String toString(){
StringBuffer sb=new StringBuffer("Login:");
sb.append(super.toString());
sb.append("userId");
sb.append("=");
sb.append(userId);
sb.append(" ");
sb.append("password");
sb.append("=");
sb.append(password);
sb.append(" ");
return sb.toString();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -