⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 messageevent.java

📁 java编的邮件客户端
💻 JAVA
字号:
package mfetcher;// MessageEvent//// Copyright (C) 1999 John Mettraux//// This program is free software; you can redistribute it and/or// modify it under the terms of the GNU General Public License// as published by the Free Software Foundation.//// This program is distributed in the hope that it will be useful,// but WITHOUT ANY WARRANTY; without even the implied warranty of// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the// GNU General Public License for more details.//// You should have received a copy of the GNU General Public License// along with this program; if not, write to the Free Software// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.///** * MailMessage content and important infos (sender and subject) * Commands are separated from comments. * * @author John Mettraux * @version 1.0 */public class MessageEvent{//// DATAS    private String from;    private String subject;    private String to;    private String[] messageBody;    private final static String UNKNOWN = "<unknown>";    //// CONSTRUCTORS    /**     * Instantiates a MessageEvent by building it from a raw array of Strings     *     * param message The mail message as an array of lines     */    public MessageEvent (String[] message)    {        from = UNKNOWN;        subject = UNKNOWN;        to = UNKNOWN;                for (int i=0; i<message.length; i++) {            String line = message[i].toLowerCase();            if (line.startsWith("from: ")) {                if (this.from == UNKNOWN)                    this.from = message[i].substring(6);            }            else if (line.startsWith("subject: ")) {                if (this.subject == UNKNOWN)                    this.subject = message[i].substring(9);            }            else if (line.startsWith("to: ")) {                if (this.to == UNKNOWN)                    this.to = message[i].substring(4);            }        }                messageBody = new String[message.length];                for (int i=0; i<message.length; i++)            messageBody[i] = message[i];    }//// METHODS    /**     * Returns the sender field of the mail message     *     * @return String     */    public String getFrom () { return from; }    /**     * Returns the subject field of the mail message     *     * @return String     */        public String getSubject () { return subject; }       /**     * Returns the to field of the mail message     *     * @return String     */    public String getTo () { return to; }    /**     * Returns the message body in the form of an array of line     *     * @return String[]     */    public String[] getMessageBody () { return messageBody; }}

⌨️ 快捷键说明

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