www.pudn.com > 应用RMS实现用户自动登陆功能.rar > Account.java


/* 
 * Created on 2004-11-4 
 * 
 * TODO To change the template for this generated file go to 
 * Window - Preferences - Java - Code Style - Code Templates 
 */ 
package com.j2medev.autologin; 
 
import java.io.*; 
 
/** 
 * @author P2800 
 *  
 * TODO To change the template for this generated type comment go to Window - 
 * Preferences - Java - Code Style - Code Templates 
 */ 
public class Account 
{ 
    private String userName; 
    private String password; 
 
    public Account(String _userName, String _password) 
    { 
        this.userName = _userName; 
        this.password = _password; 
    } 
 
    public Account() 
    { 
 
    } 
 
    public void serialize(DataOutputStream dos) throws IOException 
    { 
        dos.writeUTF(userName); 
        dos.writeUTF(password); 
    } 
 
    public static Account deserialize(DataInputStream dis) throws IOException 
    { 
        Account account = new Account(); 
        account.setUsrName(dis.readUTF()); 
        account.setPassword(dis.readUTF()); 
 
        return account; 
    } 
 
    /** 
     * @return Returns the password. 
     */ 
    public String getPassword() 
    { 
        return password; 
    } 
 
    /** 
     * @param password 
     *            The password to set. 
     */ 
    public void setPassword(String password) 
    { 
        this.password = password; 
    } 
 
    /** 
     * @return Returns the usrName. 
     */ 
    public String getUsrName() 
    { 
        return userName; 
    } 
 
    /** 
     * @param usrName 
     *            The usrName to set. 
     */ 
    public void setUsrName(String usrName) 
    { 
        this.userName = usrName; 
    } 
}