private String makeName ( char [ ] buff , int offset , int length ) { StringBuffer dst = new StringBuffer ( length + 2 ) ; boolean seenColon = false ; boolean start = true ; // String src = new String(buff, offset, length); // DEBUG for ( ; length -- > 0 ; offset ++ ) { char ch = buff [ offset ] ; if ( Character . isLetter ( ch ) || ch == ' ' ) { start = false ; dst . append ( ch ) ; } else if ( Character . isDigit ( ch ) || ch == ' ' || ch == ' ' ) { if ( start ) dst . append ( ' ' ) ; start = false ; dst . append ( ch ) ; } else if ( ch == ' ' && ! seenColon ) { seenColon = true ; if ( start ) dst . append ( ' ' ) ; start = true ; dst . append ( translateColons ? ' ' : ch ) ; } } int dstLength = dst . length ( ) ; if ( dstLength == 0 || dst . charAt ( dstLength - 1 ) == ' ' ) dst . append ( ' ' ) ; return dst . toString ( ) . intern ( ) ; }
canonicalize case .