private static String translateSep ( String sep , boolean isProperty ) { if ( sep == null ) { return null ; } int next = sep . indexOf ( BACKSLASH_CHAR ) ; if ( next != - 1 ) { int start = 0 ; char [ ] sepArray = sep . toCharArray ( ) ; char ch = 0 ; int len = sep . length ( ) ; StringBuffer sb = new StringBuffer ( len ) ; do { sb . append ( sepArray , start , next - start ) ; start = ++ next ; if ( next >= len ) { sb . append ( BACKSLASH_CHAR ) ; break ; } if ( ! isProperty ) { ch = sepArray [ next ] ; } if ( ch == ' ' ) { sb . append ( LF_CHAR ) ; start ++ ; } else if ( ch == ' ' ) { sb . append ( CR_CHAR ) ; start ++ ; } else if ( ch == ' ' ) { sb . append ( ' ' ) ; start ++ ; } else if ( ch == BACKSLASH_CHAR ) { sb . append ( BACKSLASH_CHAR ) ; start ++ ; } else if ( ch == ' ' ) { start ++ ; sb . append ( ( char ) Integer . parseInt ( sep . substring ( start , start + 4 ) , 16 ) ) ; start += 4 ; } else if ( sep . startsWith ( "semi" , next ) ) { sb . append ( ' ' ) ; start += 4 ; } else if ( sep . startsWith ( "space" , next ) ) { sb . append ( ' ' ) ; start += 5 ; } else if ( sep . startsWith ( "quote" , next ) ) { sb . append ( DOUBLE_QUOTE_CHAR ) ; start += 5 ; } else if ( sep . startsWith ( "apos" , next ) ) { sb . append ( ' ' ) ; start += 4 ; } else { sb . append ( BACKSLASH_CHAR ) ; sb . append ( sepArray [ next ] ) ; start ++ ; } } while ( ( next = sep . indexOf ( BACKSLASH_CHAR , start ) ) != - 1 ) ; sb . append ( sepArray , start , len - start ) ; sep = sb . toString ( ) ; } return sep ; }
Translates the escaped characters in a separator string and returns the non - escaped string .