messageinfo.java

来自「《透视Java》的源码」· Java 代码 · 共 44 行

JAVA
44
字号
package covertjava.decompile;

/**
 * <p>MessageInfo is used to send additional information with each message across
 * the network. Currently it contains the name of the host that the message
 * originalted from and the name of the user who sent it.</p>
 * <p>Copyright: Copyright (c) 2004 Sams Publishing</p>
 * @author Alex Kalinovsky
 * @version 1.0
 */
public class MessageInfo implements java.io.Serializable {

    String hostName;
    String userName;

    public MessageInfo(String hostName, String userName) {
        this.hostName = hostName;
        this.userName = userName;
    }

    /**
     * @return name of the host that sent the message
     */
    public String getHostName() {
        return hostName;
    }

    /**
     * @return name of the user that sent the message
     */
    public String getUserName() {
        return userName;
    }


    /**
     * Convenience method to obtain a string that best identifies the user.
     * @return name that should be used to identify a user that sent this message
     */
    public String getDisplayName() {
        return getHostName();
    }
}

⌨️ 快捷键说明

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