Crossfire JXClient, Trunk  R20561
com.realtime.crossfire.jxclient.metaserver.MetaserverEntryParser Class Reference

Parser for response lines of metaserver response lines. More...

+ Collaboration diagram for com.realtime.crossfire.jxclient.metaserver.MetaserverEntryParser:

Public Member Functions

 MetaserverEntryParser ()
 Creates a new instance. More...
 
MetaserverEntry parseLine (@NotNull final String line) throws IOException
 Parses a metaserver response line. More...
 

Static Public Member Functions

static String format (@NotNull final MetaserverEntry entry)
 Formats a metaserver entry that returns the metaserver entry when parse with parseEntry(CharSequence). More...
 
static MetaserverEntry parseEntry (@NotNull final CharSequence entry)
 Parses a metaserver response line. More...
 

Private Member Functions

void clear ()
 Resets values for the current server entry. More...
 

Static Private Member Functions

static String replace (@NotNull final String str)
 Replaces characters with may cause parsing issues. More...
 

Private Attributes

String archBase = DEFAULT_BASE
 The "archetype base" value for the current server entry. More...
 
long bytesIn
 The "bytes in" value for the current server entry. More...
 
long bytesOut
 The "bytes out" value for the current server entry. More...
 
String codeBase = DEFAULT_BASE
 The "code base" value for the current server entry. More...
 
String comment = ""
 The "comment" value for the current server entry. More...
 
String hostname
 The "hostname" value for the current server entry. More...
 
boolean inSection
 Whether response parsing is withing a server entry. More...
 
String mapBase = DEFAULT_BASE
 The "map base" value for the current server entry. More...
 
int players
 The "players" value for the current server entry. More...
 
int updateSeconds
 The "update seconds" value for the current server entry. More...
 
int uptimeSeconds
 The "uptime seconds" value for the current server entry. More...
 
String version = UNKNOWN_VERSION
 The "server version" value for the current server entry. More...
 

Static Private Attributes

static final String DEFAULT_BASE = "not specified"
 The default for arch base, map base, and code base if none specified. More...
 
static final Pattern FIELD_SEPARATOR_PATTERN = Pattern.compile("\\|")
 The pattern to split a metaserver response line into fields. More...
 
static final String UNKNOWN_VERSION = "?"
 The default server version if none specified. More...
 

Detailed Description

Parser for response lines of metaserver response lines.

Author
Andreas Kirschbaum

Definition at line 34 of file MetaserverEntryParser.java.

Constructor & Destructor Documentation

◆ MetaserverEntryParser()

com.realtime.crossfire.jxclient.metaserver.MetaserverEntryParser.MetaserverEntryParser ( )

Creates a new instance.

Definition at line 124 of file MetaserverEntryParser.java.

References com.realtime.crossfire.jxclient.metaserver.MetaserverEntryParser.clear().

+ Here is the call graph for this function:

Member Function Documentation

◆ clear()

◆ format()

static String com.realtime.crossfire.jxclient.metaserver.MetaserverEntryParser.format ( @NotNull final MetaserverEntry  entry)
static

Formats a metaserver entry that returns the metaserver entry when parse with parseEntry(CharSequence).

Parameters
entrythe metaserver entry to format
Returns
the formatted entry

Definition at line 304 of file MetaserverEntryParser.java.

References com.realtime.crossfire.jxclient.metaserver.MetaserverEntryParser.replace().

Referenced by com.realtime.crossfire.jxclient.metaserver.ServerCache.saveInternal().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parseEntry()

◆ parseLine()

MetaserverEntry com.realtime.crossfire.jxclient.metaserver.MetaserverEntryParser.parseLine ( @NotNull final String  line) throws IOException

Parses a metaserver response line.

Parameters
linethe response line to parse
Returns
the metaserver entry, or
null
if the line is invalid
Exceptions
IOExceptionif the response line is invalid

Definition at line 178 of file MetaserverEntryParser.java.

References com.realtime.crossfire.jxclient.metaserver.MetaserverEntryParser.clear(), com.realtime.crossfire.jxclient.util.NumberParser.parseInt(), and com.realtime.crossfire.jxclient.util.NumberParser.parseLong().

Referenced by com.realtime.crossfire.jxclient.metaserver.Metaserver.updateMetaList().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ replace()

static String com.realtime.crossfire.jxclient.metaserver.MetaserverEntryParser.replace ( @NotNull final String  str)
staticprivate

Replaces characters with may cause parsing issues.

Parameters
strthe string to replace
Returns
the replaced string

Definition at line 314 of file MetaserverEntryParser.java.

Referenced by com.realtime.crossfire.jxclient.metaserver.MetaserverEntryParser.format().

+ Here is the caller graph for this function:

Member Data Documentation

◆ archBase

String com.realtime.crossfire.jxclient.metaserver.MetaserverEntryParser.archBase = DEFAULT_BASE
private

◆ bytesIn

long com.realtime.crossfire.jxclient.metaserver.MetaserverEntryParser.bytesIn
private

◆ bytesOut

long com.realtime.crossfire.jxclient.metaserver.MetaserverEntryParser.bytesOut
private

◆ codeBase

String com.realtime.crossfire.jxclient.metaserver.MetaserverEntryParser.codeBase = DEFAULT_BASE
private

◆ comment

String com.realtime.crossfire.jxclient.metaserver.MetaserverEntryParser.comment = ""
private

The "comment" value for the current server entry.

html_command is preferred over text_comment.

Definition at line 86 of file MetaserverEntryParser.java.

Referenced by com.realtime.crossfire.jxclient.metaserver.MetaserverEntryParser.clear(), and com.realtime.crossfire.jxclient.metaserver.MetaserverEntryParser.parseEntry().

◆ DEFAULT_BASE

final String com.realtime.crossfire.jxclient.metaserver.MetaserverEntryParser.DEFAULT_BASE = "not specified"
staticprivate

The default for arch base, map base, and code base if none specified.

Definition at line 46 of file MetaserverEntryParser.java.

Referenced by com.realtime.crossfire.jxclient.metaserver.MetaserverEntryParser.clear().

◆ FIELD_SEPARATOR_PATTERN

final Pattern com.realtime.crossfire.jxclient.metaserver.MetaserverEntryParser.FIELD_SEPARATOR_PATTERN = Pattern.compile("\\|")
staticprivate

The pattern to split a metaserver response line into fields.

Definition at line 52 of file MetaserverEntryParser.java.

◆ hostname

String com.realtime.crossfire.jxclient.metaserver.MetaserverEntryParser.hostname
private

◆ inSection

boolean com.realtime.crossfire.jxclient.metaserver.MetaserverEntryParser.inSection
private

Whether response parsing is withing a server entry.

Definition at line 57 of file MetaserverEntryParser.java.

◆ mapBase

String com.realtime.crossfire.jxclient.metaserver.MetaserverEntryParser.mapBase = DEFAULT_BASE
private

◆ players

int com.realtime.crossfire.jxclient.metaserver.MetaserverEntryParser.players
private

◆ UNKNOWN_VERSION

final String com.realtime.crossfire.jxclient.metaserver.MetaserverEntryParser.UNKNOWN_VERSION = "?"
staticprivate

The default server version if none specified.

Definition at line 40 of file MetaserverEntryParser.java.

Referenced by com.realtime.crossfire.jxclient.metaserver.MetaserverEntryParser.clear().

◆ updateSeconds

int com.realtime.crossfire.jxclient.metaserver.MetaserverEntryParser.updateSeconds
private

◆ uptimeSeconds

int com.realtime.crossfire.jxclient.metaserver.MetaserverEntryParser.uptimeSeconds
private

◆ version

String com.realtime.crossfire.jxclient.metaserver.MetaserverEntryParser.version = UNKNOWN_VERSION
private

The documentation for this class was generated from the following file: