java.lang.Object com.realtime.crossfire.jxclient.metaserver.MetaserverEntryParser
public class MetaserverEntryParser
Parser for response lines of metaserver response lines.
Field Summary | |
---|---|
private java.lang.String |
archBase
The "archetype base" value for the current server entry. |
private long |
bytesIn
The "bytes in" value for the current server entry. |
private long |
bytesOut
The "bytes out" value for the current server entry. |
private java.lang.String |
codeBase
The "code base" value for the current server entry. |
private java.lang.String |
comment
The "comment" value for the current server entry. |
private static java.lang.String |
DEFAULT_BASE
The default for arch base, map base, and code base if none specified. |
private static java.util.regex.Pattern |
FIELD_SEPARATOR_PATTERN
The pattern to split a metaserver response line into fields. |
private java.lang.String |
hostname
The "hostname" value for the current server entry. |
private boolean |
inSection
Whether response parsing is withing a server entry. |
private java.lang.String |
mapBase
The "map base" value for the current server entry. |
private int |
players
The "players" value for the current server entry. |
private static java.lang.String |
UNKNOWN_VERSION
The default server version if none specified. |
private int |
updateSeconds
The "update seconds" value for the current server entry. |
private int |
uptimeSeconds
The "uptime seconds" value for the current server entry. |
private java.lang.String |
version
The "server version" value for the current server entry. |
Constructor Summary | |
---|---|
MetaserverEntryParser()
Creates a new instance. |
Method Summary | |
---|---|
private void |
clear()
Resets values for the current server entry. |
static java.lang.String |
format(MetaserverEntry entry)
Format a metaserver entry that returns the metaserver entry when parse with parseEntry(CharSequence) . |
static MetaserverEntry |
parseEntry(java.lang.CharSequence entry)
Parses a metaserver response line. |
MetaserverEntry |
parseLine(java.lang.String line)
Parses a metaserver response line. |
private static java.lang.String |
replace(java.lang.String str)
Replace characters with may cause parsing issues. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
@NotNull private java.lang.String archBase
private long bytesIn
private long bytesOut
@NotNull private java.lang.String codeBase
@NotNull private java.lang.String comment
@NotNull private static final java.lang.String DEFAULT_BASE
@NotNull private static final java.util.regex.Pattern FIELD_SEPARATOR_PATTERN
@Nullable private java.lang.String hostname
private boolean inSection
@NotNull private java.lang.String mapBase
private int players
@NotNull private static final java.lang.String UNKNOWN_VERSION
private int updateSeconds
private int uptimeSeconds
@NotNull private java.lang.String version
Constructor Detail |
---|
public MetaserverEntryParser()
Method Detail |
---|
private void clear()
@NotNull public static java.lang.String format(@NotNull MetaserverEntry entry)
parseEntry(CharSequence)
.
entry
- The metaserver entry to format.
@Nullable public static MetaserverEntry parseEntry(@NotNull java.lang.CharSequence entry)
entry
- the response line to parse
null
if the line is invalid@Nullable public MetaserverEntry parseLine(@NotNull java.lang.String line) throws java.io.IOException
line
- the response line to parse
null
if the line is
invalid
java.io.IOException
- if the response line is invalid@NotNull private static java.lang.String replace(@NotNull java.lang.String str)
str
- The string to replace.