jerklib
Class EventToken

java.lang.Object
  extended by jerklib.EventToken

public class EventToken
extends Object

A Class to parse a line of IRC text

 <message>  ::= [':' <prefix> <SPACE> ] <command> <params> <crlf>
 <prefix>   ::= <servername> | <nick> [ '!' <user> ] [ '@' <host> ]
 <command>  ::= <letter> { <letter> } | <number> <number> <number>
 <SPACE>    ::= ' ' { ' ' }
 <params>   ::= <SPACE> [ ':' <trailing> | <middle> <params> ]

 <middle>   ::= <Any *non-empty* sequence of octets not including SPACE
              or NUL or CR or LF, the first of which may not be ':'>
 <trailing> ::= <Any, possibly *empty*, sequence of octets not including
                NUL or CR or LF>
 

Author:
mohadib

Constructor Summary
EventToken(String data)
          Create a new EventToken
 
Method Summary
 String arg(int index)
          Gets an argument
 List<String> args()
          Gets list of arguments
 String command()
          Gets the command
 String data()
          Returns raw event data
 String hostName()
          Gets hostname from message
 String nick()
          Get nick from message
 int numeric()
          Get the numeric code of an event.
 String prefix()
          Gets message prefix if any
 String toString()
           
 String userName()
          Get username from message
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

EventToken

public EventToken(String data)
Create a new EventToken

Parameters:
data - to parse
Method Detail

hostName

public String hostName()
Gets hostname from message

Returns:
hostname or empty string if hostname could not be parsed

userName

public String userName()
Get username from message

Returns:
username or empty string is username could not be parsed.

nick

public String nick()
Get nick from message

Returns:
nick or empty string is could not be parsed

prefix

public String prefix()
Gets message prefix if any

Returns:
returns prefix or empty string if no prefix

command

public String command()
Gets the command

Returns:
the command

args

public List<String> args()
Gets list of arguments

Returns:
list of arguments

arg

public String arg(int index)
Gets an argument

Parameters:
index -
Returns:
the argument or null if no argument at that index

data

public String data()
Returns raw event data

Returns:
raw event data

numeric

public int numeric()
Get the numeric code of an event.

Returns:
numeric or -1 if command is not numeric

toString

public String toString()
Overrides:
toString in class Object