|
jlscp v0.8 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.linuxsampler.lscp.Parser
public final class Parser
This class contains only helper functions that are used from the other classes in this library.
Method Summary | |
---|---|
protected static java.lang.String |
getCategoryInfo(java.lang.String[] resultSet,
java.lang.String category)
Gets the info character string to the specified information category. |
static java.lang.String[] |
getDirectoryList(java.lang.String path)
Returns an array containing all directories in the specified escaped path. |
static java.lang.String |
getFileName(java.lang.String path)
Extracts the file name from the specified escaped path. |
static java.lang.String |
getParentDirectory(java.lang.String path)
Gets the parent directory of the specified escaped path. |
static boolean |
hasEndingFileSeparator(java.lang.String path)
Determines whether the specified escaped path ends with a file separator. |
static boolean |
isEscaped(java.lang.String s,
int index)
Determines whether the character at the specified position is escaped with backslash. |
static java.lang.String[] |
parseArray(java.lang.String list)
Parses a comma separated list whose items are encapsulated into curly braces. |
static java.lang.Boolean[] |
parseBoolList(java.lang.String list)
Parses a comma separated list with boolean values. |
protected static org.linuxsampler.lscp.ResultSet |
parseEmptyResultSet(java.lang.String ln)
Parses an empty result set and returns an appropriate ResultSet object. |
protected static void |
parseError(java.lang.String ln,
org.linuxsampler.lscp.ResultSet rs)
Parses error message. |
static java.lang.String[] |
parseEscapedStringList(java.lang.String list)
Parses a comma separated string list, which elements contains escaped sequences. |
static java.lang.String[] |
parseEscapedStringList(java.lang.String list,
char separator)
Parses a string list, which elements contains escaped sequences. |
protected static float |
parseFloat(java.lang.String s)
Parses a float value. |
static java.lang.Float[] |
parseFloatList(java.lang.String list)
Parses a comma separated list with float values. |
protected static int |
parseInt(java.lang.String s)
Parses an integer value. |
static java.lang.Integer[] |
parseIntList(java.lang.String list)
Parses a comma separated list with integer values. |
static java.lang.Integer[] |
parseIntList(java.lang.String list,
char separator)
Parses a list of integer values. |
static java.lang.String[] |
parseList(java.lang.String list)
Parses a comma separated list. |
static java.lang.String[] |
parseList(java.lang.String list,
char separator)
Parses a list. |
protected static java.lang.String[][] |
parseListOfStringLists(java.lang.String list)
|
protected static java.lang.Boolean |
parseMultiplicity(java.lang.String[] resultSet)
Determines whether the parameter represented by the specified result set allows only one value or a list of values. |
static java.lang.String[] |
parseStringList(java.lang.String list)
Parses a comma separated list whose items are encapsulated into apostrophes. |
static java.lang.String[] |
parseStringList(java.lang.String list,
char separator)
Parses a list whose items are encapsulated into apostrophes. |
protected static ParameterType |
parseType(java.lang.String[] resultSet)
Gets the type of the parameter represented by the specified result set. |
protected static void |
parseWarning(java.lang.String ln,
org.linuxsampler.lscp.ResultSet rs)
Parses warning message. |
static java.lang.String |
removeEndingFileSeparator(java.lang.String path)
If the specified escaped path ends with a file separator, a new string is returned with the ending file separator removed. |
static java.lang.String |
removeQuotation(java.lang.String s)
Eliminates the quotation marks if the string is quoted. |
static java.lang.String |
toEscapedFileName(java.lang.Object obj)
Returns the provided file name with added escape sequences where necessary. |
static java.lang.String |
toEscapedString(java.lang.Object obj)
Returns the provided string with added escape sequences where necessary. |
static java.lang.String |
toExtendedEscapeSequence(java.lang.String escapedString)
Returns more aggressively escaped sequence of the provided escaped string. |
static java.lang.String |
toNonEscapedFileName(java.lang.Object obj)
Removes the escape sequences from the specified file name |
static java.lang.String |
toNonEscapedString(java.lang.Object obj)
Removes the escape sequences from the string obj.toString() . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
protected static int parseInt(java.lang.String s) throws LscpException
s
- The integer value to be parsed.
LscpException
- If the string does not contain valid integer value.protected static float parseFloat(java.lang.String s) throws LscpException
s
- The float value to be parsed.
LscpException
- If the string does not contain valid float value.public static java.lang.String[] parseList(java.lang.String list)
list
- The comma separated list.
String
array containing all items in the list.public static java.lang.String[] parseList(java.lang.String list, char separator)
list
- The list to parse.separator
- Provides the character used as separator.
String
array containing all items in the list.public static java.lang.Boolean[] parseBoolList(java.lang.String list)
list
- The comma separated list with boolean values.
Boolean
array containing all items in the list.public static java.lang.Integer[] parseIntList(java.lang.String list) throws LscpException
list
- The comma separated list with integer values.
Integer
array containing all items in the list.
LscpException
- if the list contains value(s) from different type.public static java.lang.Integer[] parseIntList(java.lang.String list, char separator) throws LscpException
list
- The list of integer values.separator
- Provides the character used as separator.
Integer
array containing all items in the list.
LscpException
- if the list contains value(s) from different type.public static java.lang.Float[] parseFloatList(java.lang.String list) throws LscpException
list
- The comma separated list with float values.
Float
array containing all items in the list.
LscpException
- if the list contains value(s) from different type.public static java.lang.String[] parseEscapedStringList(java.lang.String list) throws LscpException
list
- The list to parse.
String
array containing all items in the list.
LscpException
public static java.lang.String[] parseEscapedStringList(java.lang.String list, char separator) throws LscpException
list
- The list to parse.separator
- Provides the character used as separator.
String
array containing all items in the list.
LscpException
public static java.lang.String[] parseStringList(java.lang.String list) throws LscpException
list
- The comma separated list.
String
array containing all items in the list.
LscpException
- if the list is broken.public static java.lang.String[] parseStringList(java.lang.String list, char separator) throws LscpException
list
- The list of strings.separator
- Provides the character used as separator.
String
array containing all items in the list.
LscpException
- if the list is broken.protected static java.lang.String[][] parseListOfStringLists(java.lang.String list) throws LscpException
LscpException
public static java.lang.String[] parseArray(java.lang.String list) throws LscpException
list
- The comma separated list.
String
array containing all items in the list.
LscpException
- if the list is broken.protected static ParameterType parseType(java.lang.String[] resultSet)
resultSet
- A String
array containing the information categories
of a multi-line result set.
null
if the specified result set does not contain
TYPE
category.protected static java.lang.Boolean parseMultiplicity(java.lang.String[] resultSet)
resultSet
- A String
array containing the information categories
of a multi-line result set.
false
if the parameter represented by the specified result set
allows only one value and true
if allows a list of values.protected static org.linuxsampler.lscp.ResultSet parseEmptyResultSet(java.lang.String ln) throws LscpException, LSException
ResultSet
object.
Notice that the result set may be of type warning or error.
ln
- A String
representing the single line result set to be parsed.
ResultSet
object.
LscpException
- If LSCP protocol error occurs.
LSException
- If the LinuxSampler instance returns error message.protected static void parseWarning(java.lang.String ln, org.linuxsampler.lscp.ResultSet rs) throws LscpException
ln
- The warning message to be parsed.rs
- A ResultSet
instance where the warning must be stored.
LscpException
- If LSCP protocol corruption occurs.protected static void parseError(java.lang.String ln, org.linuxsampler.lscp.ResultSet rs) throws LscpException
ln
- The error message to be parsed.rs
- A ResultSet
instance where the error must be stored.
LscpException
- If LSCP protocol corruption occurs.protected static java.lang.String getCategoryInfo(java.lang.String[] resultSet, java.lang.String category)
resultSet
- A String
array containing the information categories
of a multi-line result set.category
- Specifies the category whose info character string to be returned.
null
if the specified result set does not contain that category.public static java.lang.String removeQuotation(java.lang.String s)
public static java.lang.String toEscapedString(java.lang.Object obj)
public static java.lang.String toEscapedFileName(java.lang.Object obj)
public static java.lang.String toExtendedEscapeSequence(java.lang.String escapedString)
escapedString
- Already escaped string, which should be escaped more aggressively.public static java.lang.String toNonEscapedFileName(java.lang.Object obj)
public static java.lang.String toNonEscapedString(java.lang.Object obj)
obj.toString()
.
public static boolean isEscaped(java.lang.String s, int index)
public static boolean hasEndingFileSeparator(java.lang.String path)
public static java.lang.String removeEndingFileSeparator(java.lang.String path)
public static java.lang.String getParentDirectory(java.lang.String path)
public static java.lang.String getFileName(java.lang.String path)
null
is returned.
public static java.lang.String[] getDirectoryList(java.lang.String path)
|
jlscp v0.8 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |