private static void checkForValidEscapedCharacter ( int index , String labelDescriptor ) { if ( index >= labelDescriptor . length ( ) ) { throw new IllegalArgumentException ( "The label descriptor contains an invalid escape sequence. Backslash " + "characters (\\) must be followed by either an ampersand (&) or another " + "backslash." ) ; } char escapedChar = labelDescriptor . charAt ( index ) ; if ( escapedChar != ' ' && escapedChar != ' ' ) { throw new IllegalArgumentException ( "The label descriptor [" + labelDescriptor + "] contains an invalid escape sequence. Backslash " + "characters (\\) must be followed by either an ampersand (&) or another " + "backslash." ) ; } }
Confirms that the character at the specified index within the given label descriptor is a valid escapable character . i . e . either an ampersand or backslash .