public class IRCUtil extends Object implements IRCConstants
The most description of the numeric errors and numeric replies are copied from RFC1459.
DefaultIRCConnection,
IRCEventListener.onError(int, String),
IRCEventListener.onReply(int, String, String)BOLD_INDICATOR, COLOR_END_INDICATOR, COLOR_INDICATOR, COLOR_REVERSE_INDICATOR, UNDERLINE_INDICATOR| Modifier and Type | Method and Description |
|---|---|
static boolean |
isChan(String str)
According to RFC2812 the channel's name may and must start with one of the
following characters.
|
static int |
parseInt(String str)
Parses a
String to an int via
Integer.parseInt but avoids the
NumberFormatException. |
static String[] |
split(String str,
int delim)
Splits a string into substrings.
|
static String[] |
split(String str,
int delim,
String trailing)
Splits a string into substrings.
|
static String |
stripColors(String str)
Erases the mIRC colorcodes from a String.
|
static StringBuilder |
stripColors(StringBuilder buf)
Erases the mIRC colorcodes from a StringBuilder.
|
static StringBuilder |
stripColorsAndCTCPDelimiters(StringBuilder buf)
Erases the mIRC colorcodes and CTCP delimiters from a StringBuilder.
|
static int[] |
toArray(Collection<Integer> list) |
public static boolean isChan(String str)
str - The name to check if it's a channel.true if the argument starts with one of the characters
mentioned above.public static int parseInt(String str)
String to an int via
Integer.parseInt but avoids the
NumberFormatException.str - The String to parse.int. -1 if
NumberFormatException was thrown.public static String stripColors(String str)
Calling this method is equivalent to
IRCUtil.stripColors(new StringBuilder(str), false).toString().
str - The line which should be parsed.stripColorsAndCTCPDelimiters(StringBuilder)public static StringBuilder stripColors(StringBuilder buf)
Calling this method is equivalent to
IRCUtil.stripColors(buf, false).
buf - The line which should be parsed.stripColorsAndCTCPDelimiters(StringBuilder)public static StringBuilder stripColorsAndCTCPDelimiters(StringBuilder buf)
Calling this method is equivalent to
IRCUtil.stripColors(buf, true).
buf - The line which should be parsed.StringBuilder object which is cleaned from
any mIRC colorcodes.public static String[] split(String str, int delim, String trailing)
str - The string which is to split.delim - The delimiter character, for example a space ' '.trailing - The ending which is added as a substring though it wasn't
in the str. This parameter is just for the
IRCParser class which uses this method to
split the middle part into the parameters.
But as last parameter always the trailing is
added. This is done here because it's the fastest way to
do it here.
If the end is null or
"", nothing is appended.split(String, int)public static String[] split(String str, int delim)
split(str, delim, null).str - The string which is to split.delim - The delimiter character, for example a space ' '.split(String, int, String)public static int[] toArray(Collection<Integer> list)
Copyright © 2006–2015. All rights reserved.