account.java

来自「应用RMS实现用户自动登陆功能」· Java 代码 · 共 81 行

JAVA
81
字号
/*
 * 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;
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?