Translate the given String
into a int []
representing the pattern matchable by this class.
This function translates a String
into an int array converting the special '*' and '\' characters.
Here is how the conversion algorithm works:
- The '*' character is converted to MATCH_FILE, meaning that zero or more characters (excluding the path separator '/') are to be matched.
- The '**' sequence is converted to MATCH_PATH, meaning that zero or more characters (including the path separator '/') are to be matched.
- The '\' character is used as an escape sequence ('\*' is translated in '*', not in MATCH_FILE). If an exact '\' character is to be matched the source string must contain a '\\'. sequence.
When more than two '*' characters, not separated by another character, are found their value is considered as '**' (MATCH_PATH).
The array is always terminated by a special value (MATCH_END).
All MATCH* values are less than zero, while normal characters are equal or greater.
@param data The string to translate.
@return The encoded string as an int array, terminated by the MATCH_ENDvalue (don't consider the array length).
@throws NullPointerException If data is null.