private static String[] splitComponents(String str){
  List<String> l=new ArrayList<>();
  int last=0;
  int depth=0;
  char[] chars=str.toCharArray();
  for (int i=0; i < chars.length; i++) {
switch (chars[i]) {
case '(':
      depth++;
    break;
case ')':
  depth--;
break;
case ',':
if (depth == 0) {
String s=str.substring(last,i);
l.add(s);
last=i + 1;
}
break;
default :
}
}
String s=str.substring(last);
if (s.length() != 0) {
l.add(s);
}
String[] rc=new String[l.size()];
l.toArray(rc);
return rc;
}

private static String [ ] splitComponents ( String str ) { List < String > l = new ArrayList < > ( ) ; int last = 0 ; int depth = 0 ; char [ ] chars = str . toCharArray ( ) ; for ( int i = 0 ; i < chars . length ; i ++ ) { switch ( chars [ i ] ) { case '(' : depth ++ ; break ; case ')' : depth -- ; break ; case ',' : if ( depth == 0 ) { String s = str . substring ( last , i ) ; l . add ( s ) ; last = i + 1 ; } break ; default : } } String s = str . substring ( last ) ; if ( s . length ( ) != 0 ) { l . add ( s ) ; } String [ ] rc = new String [ l . size ( ) ] ; l . toArray ( rc ) ; return rc ; }
given the inner portion of a composite uri , split and return each inner uri as a string element in a new string array .
