public String toString() {
			StringWriter ret=new StringWriter();
			String typeName;
			if (type==EVENT_READYSTATE) typeName="ReadyState";
			else if (type==EVENT_MESSAGE) typeName="Message";
			else if (type==EVENT_ERROR) typeName="Error";
			else typeName=String.valueOf(type);
			
			ret.write("<Event ");
			ret.append(typeName);
			ret.append(", readyState=");
			ret.append(String.valueOf(readyState));
			ret.append(">\n");
			if (type==EVENT_ERROR && error!=null) {
				PrintWriter pout=new PrintWriter(ret);
				error.printStackTrace(pout);
				pout.flush();
			} else if (type==EVENT_MESSAGE) {
				ret.append(message.toString());
			}
			ret.append("</Event>");
			return ret.toString();
		}