Main Page | Packages | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

SerialIOEvent.java

Go to the documentation of this file.
00001 /*
00002  * SerialIOEvent.java
00003  *
00004  * Copyright (C) 2005 Project SQUID, http://www.cs.helsinki.fi/group/squid/
00005  *
00006  * This file is part of Ikayaki.
00007  *
00008  * Ikayaki is free software; you can redistribute it and/or modify
00009  * it under the terms of the GNU General Public License as published by
00010  * the Free Software Foundation; either version 2 of the License, or
00011  * (at your option) any later version.
00012  *
00013  * Ikayaki is distributed in the hope that it will be useful,
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00016  * GNU General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU General Public License
00019  * along with Ikayaki; if not, write to the Free Software
00020  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
00021  */
00022 
00023 package ikayaki.squid;
00024 
00025 import java.util.EventObject;
00026 
00032 public class SerialIOEvent extends EventObject {
00033 
00037     private String message;
00038 
00039     public SerialIOEvent(Object source, String message) {
00040         super(source);
00041         this.message = message;
00042     }
00043 
00049     public String getMessage() {
00050         return this.message;
00051     }
00052 
00058     public String getCleanMessage() {
00059         String result = "";
00060         for (int i = 0; i < message.length(); i++) {
00061             char c = message.charAt(i);
00062             if (c != '\r') {
00063                 result += c;
00064             }
00065         }
00066         return result.trim();
00067     }
00068 
00074     public String getLogMessage() {
00075         String result = "";
00076         for (int i = 0; i < message.length(); i++) {
00077             char c = message.charAt(i);
00078             if (c == '\r') {
00079                 result += "\\r";
00080             } else if (c == '\n') {
00081                 result += "\\n";
00082             } else {
00083                 result += c;
00084             }
00085         }
00086         return result;
00087     }
00088 }

Generated on Fri May 6 16:00:33 2005 for Squid by  doxygen 1.4.1